From 5e9c424f1f89b9cc576e480a9d04e84d73c0d14b Mon Sep 17 00:00:00 2001 From: Jingyi Hu Date: Sun, 26 May 2019 17:17:27 -0700 Subject: [PATCH] *: more clarification on server config file Be more explicit in document and command line usage message that if a config file is provided, other command line flags and environment variables will be ignored. --- Documentation/op-guide/configuration.md | 4 ++-- etcdmain/config.go | 2 +- etcdmain/help.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/op-guide/configuration.md b/Documentation/op-guide/configuration.md index d2ff02547..5a5e18d9d 100644 --- a/Documentation/op-guide/configuration.md +++ b/Documentation/op-guide/configuration.md @@ -4,7 +4,7 @@ title: Configuration flags etcd is configurable through a configuration file, various command-line flags, and environment variables. -A reusable configuration file is a YAML file made with name and value of one or more command-line flags described below. In order to use this file, specify the file path as a value to the `--config-file` flag. The [sample configuration file][sample-config-file] can be used as a starting point to create a new configuration file as needed. +A reusable configuration file is a YAML file made with name and value of one or more command-line flags described below. In order to use this file, specify the file path as a value to the `--config-file` flag or `ETCD_CONFIG_FILE` environment variable. The [sample configuration file][sample-config-file] can be used as a starting point to create a new configuration file as needed. Options set on the command line take precedence over those from the environment. If a configuration file is provided, other command line flags and environment variables will be ignored. For example, `etcd --config-file etcd.conf.yml.sample --data-dir /tmp` will ignore the `--data-dir` flag. @@ -372,7 +372,7 @@ Follow the instructions when using these flags. + default: false ### --config-file -+ Load server configuration from a file. ++ Load server configuration from a file. Note that if a configuration file is provided, other command line flags and environment variables will be ignored. + default: "" + example: [sample configuration file][sample-config-file] + env variable: ETCD_CONFIG_FILE diff --git a/etcdmain/config.go b/etcdmain/config.go index e70f7df1b..5cc2c8f6f 100644 --- a/etcdmain/config.go +++ b/etcdmain/config.go @@ -127,7 +127,7 @@ func newConfig() *config { fmt.Fprintln(os.Stderr, usageline) } - fs.StringVar(&cfg.configFile, "config-file", "", "Path to the server configuration file") + fs.StringVar(&cfg.configFile, "config-file", "", "Path to the server configuration file. Note that if a configuration file is provided, other command line flags and environment variables will be ignored.") // member fs.StringVar(&cfg.ec.Dir, "data-dir", cfg.ec.Dir, "Path to the data directory.") diff --git a/etcdmain/help.go b/etcdmain/help.go index 2b55f72da..12eb5059f 100644 --- a/etcdmain/help.go +++ b/etcdmain/help.go @@ -35,7 +35,7 @@ var ( Show the help information about etcd. etcd --config-file - Path to the server configuration file. + Path to the server configuration file. Note that if a configuration file is provided, other command line flags and environment variables will be ignored. etcd gateway Run the stateless pass-through etcd TCP connection forwarding proxy.