Skip to content

Commit

Permalink
clean up configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
kelseyhightower committed Jul 7, 2014
1 parent dae6571 commit 473e5c8
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 36 deletions.
13 changes: 7 additions & 6 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type Config struct {
}

func init() {
flag.StringVar(&backend, "backend", "", "backend to use")
flag.StringVar(&backend, "backend", "etcd", "backend to use")
flag.StringVar(&clientCaKeys, "client-ca-keys", "", "client ca keys")
flag.StringVar(&clientCert, "client-cert", "", "the client cert")
flag.StringVar(&clientKey, "client-key", "", "the client key")
Expand All @@ -71,13 +71,13 @@ func init() {
flag.BoolVar(&debug, "debug", false, "enable debug logging")
flag.IntVar(&interval, "interval", 600, "backend polling interval")
flag.Var(&nodes, "node", "list of backend nodes")
flag.BoolVar(&noop, "noop", false, "only show pending changes, don't sync configs.")
flag.BoolVar(&noop, "noop", false, "only show pending changes")
flag.BoolVar(&onetime, "onetime", false, "run once and exit")
flag.StringVar(&prefix, "prefix", "/", "key path prefix")
flag.StringVar(&prefix, "prefix", "", "key path prefix")
flag.BoolVar(&printVersion, "version", false, "print version and exit")
flag.BoolVar(&quiet, "quiet", false, "enable quiet logging. Only error messages are printed.")
flag.StringVar(&scheme, "backend-scheme", "http", "the backend URI scheme. (http or https)")
flag.StringVar(&srvDomain, "srv-domain", "", "the domain for the backend SRV record, i.e. example.com")
flag.BoolVar(&quiet, "quiet", false, "enable quiet logging")
flag.StringVar(&scheme, "scheme", "http", "the backend URI scheme (http or https)")
flag.StringVar(&srvDomain, "srv-domain", "", "the name of the resource record")
flag.BoolVar(&verbose, "verbose", false, "enable verbose logging")
}

Expand All @@ -93,6 +93,7 @@ func initConfig() error {
}
// Set defaults.
config = Config{
Backend: "etcd",
BackendNodes: []string{"127.0.0.1:4001"},
ConfDir: "/etc/confd",
Interval: 600,
Expand Down
12 changes: 6 additions & 6 deletions docs/command-line-flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ confd -h

```Text
Usage of confd:
-backend="": backend to use
-backend-scheme="http": the backend URI scheme. (http or https)
-backend="etcd": backend to use
-client-ca-keys="": client ca keys
-client-cert="": the client cert
-client-key="": the client key
Expand All @@ -18,11 +17,12 @@ Usage of confd:
-debug=false: enable debug logging
-interval=600: backend polling interval
-node=[]: list of backend nodes
-noop=false: only show pending changes, don't sync configs.
-noop=false: only show pending changes
-onetime=false: run once and exit
-prefix="/": key path prefix
-quiet=false: enable quiet logging. Only error messages are printed.
-srv-domain="": the domain for the backend SRV record, i.e. example.com
-prefix="": key path prefix
-quiet=false: enable quiet logging
-scheme="http": the backend URI scheme (http or https)
-srv-domain="": the name of the resource record
-verbose=false: enable verbose logging
-version=false: print version and exit
```
48 changes: 24 additions & 24 deletions docs/configuration-guide.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
# Configuration Guide

The confd configuration file is written in [TOML](https://github.com/mojombo/toml)
and loaded from `/etc/confd/confd.toml` by default. You can specify a different config file location via the `-config-file` command line flag.

```Bash
confd -config-file ~/confd.toml
```
and loaded from `/etc/confd/confd.toml` by default. You can specify the config file via the `-config-file` command line flag.

> Note: You can use confd without a configuration file. See [Command Line Flags](https://github.com/kelseyhightower/confd/wiki/Command-Line-Flags).
Optional:

* `backend` (string) - The configuration backend to use. The default is etcd.
* `backend` (string) - The backend to use. (etcd)
* `client_cakeys` (string) - The client CA key file.
* `client_cert` (string) - The client cert file.
* `client_key` (string) - The client key file.
* `confdir` (string) - The path to confd configs. (/etc/confd)
* `debug` (bool) - Enable debug logging.
* `client_cert` (string) The cert file of the client.
* `client_key` (string) The key file of the client.
* `confdir` (string) - The path to confd configs. The default is /etc/confd.
* `nodes` (array of strings) - An array of backend cluster nodes. The default
is ["http://127.0.0.1:4001"].
* `interval` (int) - The number of seconds to wait between calls to etcd. The
default is 600.
* `noop` (bool) - Enable noop mode. Process all template resource, but don't update target config.
* `prefix` (string) - The prefix string to prefix to keys when making calls to
the backend. The default is "/".
* `quiet` (bool) - Enable quiet logging. Only error messages are printed.
* `srv_domain` (string) - The domain to query for backend SRV records.
* `interval` (int) - The backend polling interval. (600)
* `nodes` (array of strings) - List of backend nodes. (["127.0.0.1:4001"])
* `noop` (bool) - Enable noop mode. Process all template resources; skip target update.
* `prefix` (string) - The string to prefix to keys.
* `quiet` (bool) - Enable quiet logging.
* `scheme` (string) - The backend URI scheme. (http or https)
* `srv_domain` (string) - The name of the resource record.
* `verbose` (bool) - Enable verbose logging.

Example:

```TOML
[confd]
backend = "etcd"
confdir = "/etc/confd"
client_cert = "/etc/confd/ssl/client.crt"
client_key = "/etc/confd/ssl/client.key"
confdir = "/etc/confd"
debug = false
interval = 600
prefix = "/"
nodes = [
"http://127.0.0.1:4001",
"127.0.0.1:4001",
]
client_cert = "/etc/confd/ssl/client.crt"
client_key = "/etc/confd/ssl/client.key"
noop = false
prefix = "/production"
quiet = false
scheme = "https"
srv_domain = "etcd.example.com"
verbose = false
```

0 comments on commit 473e5c8

Please sign in to comment.