konf
A configuration management CLI intended to remove the need to memorize config syntax.
Overview
Konf is a Command Line Interface tool designed to generate and manage configuration files for various systems. Currently, it features robust support for Caddy web server configurations, allowing developers to generate Caddyfile blocks for static sites, reverse proxies, rate limiting, and upload limits without manually editing configuration files.
Installation
Ensure you have Go installed on your system. You can install konf directly from the source:
go install github.com/phillip-england/konf@latest
Or clone the repository and build locally:
git clone https://github.com/Phillip-England/konf.git
cd konf
go build -o konf main.go
Usage
The general syntax is konf [command] [subcommand] [flags].
Initialization
Initialize a new Caddyfile in the current directory.
konf caddy init
| Flag | Description | Default |
|---|---|---|
-f, --force |
Overwrite existing Caddyfile if it exists | false |
Adding a Static Site
Add a basic file server block for a specific host.
konf caddy add site example.com --root ./public
| Argument/Flag | Description |
|---|---|
<host> |
The domain name (e.g., localhost, example.com) |
--root |
(Optional) The root path for the file server |
Adding a Reverse Proxy
Forward traffic from a host to an upstream service.
konf caddy add proxy api.example.com localhost:8080
| Argument | Description |
|---|---|
<host> |
The domain name |
<upstream> |
The upstream destination (e.g., localhost:3000) |
Adding Rate Limiting
Apply rate limits to a host. Note: This requires a Caddy build with the rate-limit plugin.
konf caddy add rate-limit api.example.com --events 100 --window 1m
| Flag | Description | Default |
|---|---|---|
--events |
Events allowed per window | 100 |
--window |
Window duration (e.g., 1m, 10s) | 1m |
--burst |
Burst allowance | 0 |
--zone |
Rate limit zone name | default |
--match |
Optional path matcher (e.g., /api/*) | (empty) |
Adding Upload Limits
Restrict the maximum request body size (file uploads).
konf caddy add upload-limit files.example.com --max 10MB
| Flag | Description |
|---|---|
--max |
Max upload size (Required, e.g., 10MB) |
--match |
Optional path matcher (e.g., /upload/*) |
Project Structure
konf/
├── cmd/ (CLI Command Definitions)
│ ├── caddy.go
│ ├── caddy_add.go
│ ├── caddy_add_proxy.go
│ ├── caddy_add_rate_limit.go
│ ├── caddy_add_site.go
│ ├── caddy_add_upload_limit.go
│ ├── caddy_init.go
│ └── root.go
├── internal/ (Core Logic)
│ └── caddy/
│ ├── manager.go (File I/O & Block Generation)
│ └── templates.go
├── go.mod
└── main.go
Generated based on repository state as of January 2026.
View on GitHub