Browse Source

agent: Switch to -data-dir, better error if missing. Fixes #2.

pull/19/head
Armon Dadgar 11 years ago
parent
commit
13af774cb9
  1. 8
      command/agent/command.go
  2. 4
      website/source/docs/agent/options.html.markdown

8
command/agent/command.go

@ -51,7 +51,7 @@ func (c *Command) readConfig() *Config {
cmdFlags.StringVar(&cmdConfig.NodeName, "node", "", "node name")
cmdFlags.StringVar(&cmdConfig.RPCAddr, "rpc-addr", "",
"address to bind RPC listener to")
cmdFlags.StringVar(&cmdConfig.DataDir, "data", "", "path to the data directory")
cmdFlags.StringVar(&cmdConfig.DataDir, "data-dir", "", "path to the data directory")
cmdFlags.StringVar(&cmdConfig.Datacenter, "dc", "", "node datacenter")
cmdFlags.StringVar(&cmdConfig.DNSRecursor, "recursor", "", "address of dns recursor")
cmdFlags.StringVar(&cmdConfig.AdvertiseAddr, "advertise", "", "advertise address to use")
@ -93,6 +93,12 @@ func (c *Command) readConfig() *Config {
}
}
// Ensure we have a data directory
if config.DataDir == "" {
c.Ui.Error("Must specify data directory using -data-dir")
return nil
}
return config
}

4
website/source/docs/agent/options.html.markdown

@ -78,7 +78,7 @@ The options below are all specified on the command-line.
in order to query a running Consul agent. It is also used by other applications
to control Consul using it's [RPC protocol](/docs/agent/rpc.html).
* `-data` - This flag provides a data directory for the agent to store state.
* `-data-dir` - This flag provides a data directory for the agent to store state.
This is required for all agents. The directory should be durable across reboots.
This is especially critical for agents that are running in server mode, as they
must be able to persist the cluster state.
@ -152,7 +152,7 @@ They are documented seperately under [check configuration](/docs/agent/checks.ht
* `datacenter` - Equivalent to the `-dc` command-line flag.
* `data_dir` - Equivalent to the `-data` command-line flag.
* `data_dir` - Equivalent to the `-data-dir` command-line flag.
* `dns_addr` - Equivalent to the `-dns-addr` command-line flag.

Loading…
Cancel
Save