Skip to content

Commit

Permalink
Merge pull request #2918 from hashicorp/pr-2577-slackpad
Browse files Browse the repository at this point in the history
Provide error if -ui and -ui-dir are both specified
  • Loading branch information
slackpad authored Apr 18, 2017
2 parents b909837 + d4058b1 commit d3ae23f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions command/agent/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,13 @@ func (c *Command) readConfig() *Config {
// Verify the node metadata entries are valid
if err := structs.ValidateMetadata(config.Meta); err != nil {
c.Ui.Error(fmt.Sprintf("Failed to parse node metadata: %v", err))
}

// It doesn't make sense to include both UI options.
if config.EnableUi == true && config.UiDir != "" {
c.Ui.Error("Both the ui and ui-dir flags were specified, please provide only one")
c.Ui.Error("If trying to use your own web UI resources, use the ui-dir flag")
c.Ui.Error("If using Consul version 0.7.0 or later, the web UI is included in the binary so use ui to enable it")
return nil
}

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 @@ -362,7 +362,7 @@ will exit with an error at startup.

* <a name="_ui_dir"></a><a href="#_ui_dir">`-ui-dir`</a> - This flag provides the directory containing
the Web UI resources for Consul. This will automatically enable the Web UI. The directory must be
readable to the agent. Starting with Consul version 0.7.0 and later, the Web UI assets are included in the binary so this flag is no longer necessary; specifying only the `-ui` flag is enough to enable the Web UI.
readable to the agent. Starting with Consul version 0.7.0 and later, the Web UI assets are included in the binary so this flag is no longer necessary; specifying only the `-ui` flag is enough to enable the Web UI. Specifying both the '-ui' and '-ui-dir' flags will result in an error.

## <a name="configuration_files"></a>Configuration Files

Expand Down Expand Up @@ -1055,7 +1055,7 @@ Consul will not enable TLS for the HTTP API unless the `https` port has been ass
command-line flag.

* <a name="ui_dir"></a><a href="#ui_dir">`ui_dir`</a> - Equivalent to the
[`-ui-dir`](#_ui_dir) command-line flag. This configuration key is not required as of Consul version 0.7.0 and later.
[`-ui-dir`](#_ui_dir) command-line flag. This configuration key is not required as of Consul version 0.7.0 and later. Specifying this configuration key will enable the web UI. There is no need to specify both ui-dir and ui. Specifying both will result in an error.

* <a name="unix_sockets"></a><a href="#unix_sockets">`unix_sockets`</a> - This
allows tuning the ownership and permissions of the
Expand Down

0 comments on commit d3ae23f

Please sign in to comment.