Skip to content

Commit

Permalink
Merge pull request #3327 from jrasell/f_gh_3304
Browse files Browse the repository at this point in the history
Update agent CLI to include Consul config option flags.
  • Loading branch information
dadgar committed Oct 5, 2017
2 parents 400958b + f98f403 commit 262a695
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 0 deletions.
95 changes: 95 additions & 0 deletions command/agent/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func (c *Command) readConfig() *Config {
cmdConfig := &Config{
Atlas: &AtlasConfig{},
Client: &ClientConfig{},
Consul: &config.ConsulConfig{},
Ports: &Ports{},
Server: &ServerConfig{},
Vault: &config.VaultConfig{},
Expand Down Expand Up @@ -110,6 +111,39 @@ func (c *Command) readConfig() *Config {
flags.BoolVar(&cmdConfig.Atlas.Join, "atlas-join", false, "")
flags.StringVar(&cmdConfig.Atlas.Token, "atlas-token", "", "")

// Consul options
flags.StringVar(&cmdConfig.Consul.Auth, "consul-auth", "", "")
flags.Var((flaghelper.FuncBoolVar)(func(b bool) error {
cmdConfig.Consul.AutoAdvertise = &b
return nil
}), "consul-auto-advertise", "")
flags.StringVar(&cmdConfig.Consul.CAFile, "consul-ca-file", "", "")
flags.StringVar(&cmdConfig.Consul.CertFile, "consul-cert-file", "", "")
flags.Var((flaghelper.FuncBoolVar)(func(b bool) error {
cmdConfig.Consul.ChecksUseAdvertise = &b
return nil
}), "consul-checks-use-advertise", "")
flags.Var((flaghelper.FuncBoolVar)(func(b bool) error {
cmdConfig.Consul.ClientAutoJoin = &b
return nil
}), "consul-client-auto-join", "")
flags.StringVar(&cmdConfig.Consul.ClientServiceName, "consul-client-service-name", "", "")
flags.StringVar(&cmdConfig.Consul.KeyFile, "consul-key-file", "", "")
flags.StringVar(&cmdConfig.Consul.ServerServiceName, "consul-server-service-name", "", "")
flags.Var((flaghelper.FuncBoolVar)(func(b bool) error {
cmdConfig.Consul.ServerAutoJoin = &b
return nil
}), "consul-server-auto-join", "")
flags.Var((flaghelper.FuncBoolVar)(func(b bool) error {
cmdConfig.Consul.EnableSSL = &b
return nil
}), "consul-ssl", "")
flags.StringVar(&cmdConfig.Consul.Token, "consul-token", "", "")
flags.Var((flaghelper.FuncBoolVar)(func(b bool) error {
cmdConfig.Consul.VerifySSL = &b
return nil
}), "consul-verify-ssl", "")

// Vault options
flags.Var((flaghelper.FuncBoolVar)(func(b bool) error {
cmdConfig.Vault.Enabled = &b
Expand Down Expand Up @@ -950,6 +984,67 @@ Client Options:
The default speed for network interfaces in MBits if the link speed can not
be determined dynamically.
Consul Options:
-consul-address=<addr>
Specifies the address to the local Consul agent, given in the format host:port.
Supports Unix sockets with the format: unix:///tmp/consul/consul.sock
-consul-auth=<auth>
Specifies the HTTP Basic Authentication information to use for access to the
Consul Agent, given in the format username:password.
-consul-auto-advertise
Specifies if Nomad should advertise its services in Consul. The services
are named according to server_service_name and client_service_name. Nomad
servers and clients advertise their respective services, each tagged
appropriately with either http or rpc tag. Nomad servers also advertise a
serf tagged service.
-consul-ca-file=<path>
Specifies an optional path to the CA certificate used for Consul communication.
This defaults to the system bundle if unspecified.
-consul-cert-file=<path>
Specifies the path to the certificate used for Consul communication. If this
is set then you need to also set key_file.
-consul-checks-use-advertise
Specifies if Consul heath checks should bind to the advertise address. By
default, this is the bind address.
-consul-client-auto-join
Specifies if the Nomad clients should automatically discover servers in the
same region by searching for the Consul service name defined in the
server_service_name option.
-consul-client-service-name=<name>
Specifies the name of the service in Consul for the Nomad clients.
-consul-key-file=<path>
Specifies the path to the private key used for Consul communication. If this
is set then you need to also set cert_file.
-consul-server-service-name=<name>
Specifies the name of the service in Consul for the Nomad servers.
-consul-server-auto-join
Specifies if the Nomad servers should automatically discover and join other
Nomad servers by searching for the Consul service name defined in the
server_service_name option. This search only happens if the server does not
have a leader.
-consul-ssl
Specifies if the transport scheme should use HTTPS to communicate with the
Consul agent.
-consul-token=<token>
Specifies the token used to provide a per-request ACL token.
-consul-verify-ssl
Specifies if SSL peer verification should be used when communicating to the
Consul API client over HTTPS.
Vault Options:
-vault-enabled
Expand Down
14 changes: 14 additions & 0 deletions website/source/docs/commands/agent.html.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ via CLI arguments. The `agent` command accepts the following arguments:
* `-client`: Enable client mode on the local agent.
* `-config=<path>`: Specifies the path to a configuration file or a directory of
configuration files to load. Can be specified multiple times.
* `-consul-address=<addr>`: Equivalent to the [address](/docs/agent/configuration/consul.html#address) config option.
* `-consul-auth=<auth>`: Equivalent to the [auth](/docs/agent/configuration/consul.html#auth) config option.
* `-consul-auto-advertise`: Equivalent to the [auto_advertise](/docs/agent/configuration/consul.html#auto_advertise) config option.
* `-consul-ca-file=<path>`: Equivalent to the [ca_file](/docs/agent/configuration/consul.html#ca_file) config option.
* `-consul-cert-file=<path>`: Equivalent to the [cert_file](/docs/agent/configuration/consul.html#cert_file) config option.
* `-consul-checks-use-advertise`: Equivalent to the [checks_use_advertise](/docs/agent/configuration/consul.html#checks_use_advertise) config option.
* `-consul-client-auto-join`: Equivalent to the [client_auto_join](/docs/agent/configuration/consul.html#client_auto_join) config option.
* `-consul-client-service-name=<name>`: Equivalent to the [client_service_name](/docs/agent/configuration/consul.html#client_service_name) config option.
* `-consul-key-file=<path>`: Equivalent to the [key_file](/docs/agent/configuration/consul.html#key_file) config option.
* `-consul-server-service-name=<name>`: Equivalent to the [server_service_name](/docs/agent/configuration/consul.html#server_service_name) config option.
* `-consul-server-auto-join`: Equivalent to the [server_auto_join](/docs/agent/configuration/consul.html#server_auto_join) config option.
* `-consul-ssl`: Equivalent to the [ssl](/docs/agent/configuration/consul.html#ssl) config option.
* `-consul-token=<token>`: Equivalent to the [token](/docs/agent/configuration/consul.html#token) config option.
* `-consul-verify-ssl`: Equivalent to the [verify_ssl](/docs/agent/configuration/consul.html#verify_ssl) config option.
* `-data-dir=<path>`: Equivalent to the [data_dir](#data_dir) config option.
* `-dc=<datacenter>`: Equivalent to the [datacenter](#datacenter) config option.
* `-dev`: Start the agent in development mode. This enables a pre-configured
Expand Down

0 comments on commit 262a695

Please sign in to comment.