Skip to content

Commit

Permalink
agent: Switch to -data-dir, better error if missing. Fixes #2.
Browse files Browse the repository at this point in the history
  • Loading branch information
armon committed Feb 23, 2014
1 parent 49ba21a commit 13af774
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion command/agent/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions website/source/docs/agent/options.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.

Expand Down

0 comments on commit 13af774

Please sign in to comment.