|
|
@@ -128,12 +128,22 @@ func newConfig() *config {
|
|
|
fs.StringVar(&cfg.configFile, "config-file", "", "Path to the server configuration file")
|
|
|
|
|
|
// member
|
|
|
- fs.Var(cfg.ec.CorsInfo, "cors", "Comma-separated white list of origins for CORS (cross-origin resource sharing).")
|
|
|
fs.StringVar(&cfg.ec.Dir, "data-dir", cfg.ec.Dir, "Path to the data directory.")
|
|
|
fs.StringVar(&cfg.ec.WalDir, "wal-dir", cfg.ec.WalDir, "Path to the dedicated wal directory.")
|
|
|
- fs.Var(flags.NewURLsValue(embed.DefaultListenPeerURLs), "listen-peer-urls", "List of URLs to listen on for peer traffic.")
|
|
|
- fs.Var(flags.NewURLsValue(embed.DefaultListenClientURLs), "listen-client-urls", "List of URLs to listen on for client traffic.")
|
|
|
- fs.Var(flags.NewURLsValue(""), "listen-metrics-urls", "List of URLs to listen on for metrics.")
|
|
|
+ fs.Var(
|
|
|
+ flags.NewUniqueURLsWithExceptions(embed.DefaultListenPeerURLs, ""),
|
|
|
+ "listen-peer-urls",
|
|
|
+ "List of URLs to listen on for peer traffic.",
|
|
|
+ )
|
|
|
+ fs.Var(
|
|
|
+ flags.NewUniqueURLsWithExceptions(embed.DefaultListenClientURLs, ""), "listen-client-urls",
|
|
|
+ "List of URLs to listen on for client traffic.",
|
|
|
+ )
|
|
|
+ fs.Var(
|
|
|
+ flags.NewUniqueURLsWithExceptions("", ""),
|
|
|
+ "listen-metrics-urls",
|
|
|
+ "List of URLs to listen on for metrics.",
|
|
|
+ )
|
|
|
fs.UintVar(&cfg.ec.MaxSnapFiles, "max-snapshots", cfg.ec.MaxSnapFiles, "Maximum number of snapshot files to retain (0 is unlimited).")
|
|
|
fs.UintVar(&cfg.ec.MaxWalFiles, "max-wals", cfg.ec.MaxWalFiles, "Maximum number of wal files to retain (0 is unlimited).")
|
|
|
fs.StringVar(&cfg.ec.Name, "name", cfg.ec.Name, "Human-readable name for this member.")
|
|
|
@@ -148,8 +158,16 @@ func newConfig() *config {
|
|
|
fs.DurationVar(&cfg.ec.GRPCKeepAliveTimeout, "grpc-keepalive-timeout", cfg.ec.GRPCKeepAliveTimeout, "Additional duration of wait before closing a non-responsive connection (0 to disable).")
|
|
|
|
|
|
// clustering
|
|
|
- fs.Var(flags.NewURLsValue(embed.DefaultInitialAdvertisePeerURLs), "initial-advertise-peer-urls", "List of this member's peer URLs to advertise to the rest of the cluster.")
|
|
|
- fs.Var(flags.NewURLsValue(embed.DefaultAdvertiseClientURLs), "advertise-client-urls", "List of this member's client URLs to advertise to the public.")
|
|
|
+ fs.Var(
|
|
|
+ flags.NewUniqueURLsWithExceptions(embed.DefaultInitialAdvertisePeerURLs, ""),
|
|
|
+ "initial-advertise-peer-urls",
|
|
|
+ "List of this member's peer URLs to advertise to the rest of the cluster.",
|
|
|
+ )
|
|
|
+ fs.Var(
|
|
|
+ flags.NewUniqueURLsWithExceptions(embed.DefaultAdvertiseClientURLs, ""),
|
|
|
+ "advertise-client-urls",
|
|
|
+ "List of this member's client URLs to advertise to the public.",
|
|
|
+ )
|
|
|
fs.StringVar(&cfg.ec.Durl, "discovery", cfg.ec.Durl, "Discovery URL used to bootstrap the cluster.")
|
|
|
fs.Var(cfg.cf.fallback, "discovery-fallback", fmt.Sprintf("Valid values include %q", cfg.cf.fallback.Valids()))
|
|
|
|
|
|
@@ -186,7 +204,13 @@ func newConfig() *config {
|
|
|
fs.BoolVar(&cfg.ec.PeerAutoTLS, "peer-auto-tls", false, "Peer TLS using generated certificates")
|
|
|
fs.StringVar(&cfg.ec.PeerTLSInfo.CRLFile, "peer-crl-file", "", "Path to the peer certificate revocation list file.")
|
|
|
fs.StringVar(&cfg.ec.PeerTLSInfo.AllowedCN, "peer-cert-allowed-cn", "", "Allowed CN for inter peer authentication.")
|
|
|
- fs.Var(flags.NewStringsValue(""), "host-whitelist", "Comma-separated acceptable hostnames from HTTP client requests, if server is not secure (empty means allow all).")
|
|
|
+
|
|
|
+ fs.Var(
|
|
|
+ flags.NewUniqueURLsWithExceptions("*", "*"),
|
|
|
+ "cors",
|
|
|
+ "Comma-separated white list of origins for CORS, or cross-origin resource sharing, (empty or * means allow all)",
|
|
|
+ )
|
|
|
+ fs.Var(flags.NewUniqueStringsValue("*"), "host-whitelist", "Comma-separated acceptable hostnames from HTTP client requests, if server is not secure (empty means allow all).")
|
|
|
|
|
|
// logging
|
|
|
fs.BoolVar(&cfg.ec.Debug, "debug", false, "Enable debug-level logging for etcd.")
|
|
|
@@ -261,12 +285,15 @@ func (cfg *config) configFromCmdLine() error {
|
|
|
plog.Fatalf("%v", err)
|
|
|
}
|
|
|
|
|
|
- cfg.ec.LPUrls = flags.URLsFromFlag(cfg.cf.flagSet, "listen-peer-urls")
|
|
|
- cfg.ec.APUrls = flags.URLsFromFlag(cfg.cf.flagSet, "initial-advertise-peer-urls")
|
|
|
- cfg.ec.LCUrls = flags.URLsFromFlag(cfg.cf.flagSet, "listen-client-urls")
|
|
|
- cfg.ec.ACUrls = flags.URLsFromFlag(cfg.cf.flagSet, "advertise-client-urls")
|
|
|
- cfg.ec.HostWhitelist = flags.StringsFromFlag(cfg.cf.flagSet, "host-whitelist")
|
|
|
- cfg.ec.ListenMetricsUrls = flags.URLsFromFlag(cfg.cf.flagSet, "listen-metrics-urls")
|
|
|
+ cfg.ec.LPUrls = flags.UniqueURLsFromFlag(cfg.cf.flagSet, "listen-peer-urls")
|
|
|
+ cfg.ec.APUrls = flags.UniqueURLsFromFlag(cfg.cf.flagSet, "initial-advertise-peer-urls")
|
|
|
+ cfg.ec.LCUrls = flags.UniqueURLsFromFlag(cfg.cf.flagSet, "listen-client-urls")
|
|
|
+ cfg.ec.ACUrls = flags.UniqueURLsFromFlag(cfg.cf.flagSet, "advertise-client-urls")
|
|
|
+ cfg.ec.ListenMetricsUrls = flags.UniqueURLsFromFlag(cfg.cf.flagSet, "listen-metrics-urls")
|
|
|
+
|
|
|
+ cv := flags.UniqueURLsMapFromFlag(cfg.cf.flagSet, "cors")
|
|
|
+ cfg.ec.CorsInfo = &cv
|
|
|
+ cfg.ec.HostWhitelist = flags.UniqueStringsFromFlag(cfg.cf.flagSet, "host-whitelist")
|
|
|
|
|
|
cfg.ec.ClusterState = cfg.cf.clusterState.String()
|
|
|
cfg.cp.Fallback = cfg.cf.fallback.String()
|