Update website docs for validate command
This commit is contained in:
parent
fcb2594fda
commit
27ee6f974d
|
@ -16,7 +16,7 @@ type ConfigTestCommand struct {
|
|||
|
||||
func (c *ConfigTestCommand) Help() string {
|
||||
helpText := `
|
||||
Usage: consul configtest [options] FILE_OR_DIRECTORY
|
||||
Usage: consul configtest [options]
|
||||
|
||||
DEPRECATED. Use the 'consul validate' command instead.
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ type ValidateCommand struct {
|
|||
|
||||
func (c *ValidateCommand) Help() string {
|
||||
helpText := `
|
||||
Usage: consul validate [options] FILE_OR_DIRECTORY
|
||||
Usage: consul validate [options] FILE_OR_DIRECTORY...
|
||||
|
||||
Performs a basic sanity test on Consul configuration files. For each file
|
||||
or directory given, the validate command will attempt to parse the
|
||||
|
|
10
main.go
10
main.go
|
@ -37,10 +37,18 @@ func realMain() int {
|
|||
}
|
||||
}
|
||||
|
||||
// Filter out the configtest command from the help display
|
||||
var included []string
|
||||
for command := range Commands {
|
||||
if command != "configtest" {
|
||||
included = append(included, command)
|
||||
}
|
||||
}
|
||||
|
||||
cli := &cli.CLI{
|
||||
Args: args,
|
||||
Commands: Commands,
|
||||
HelpFunc: cli.BasicHelpFunc("consul"),
|
||||
HelpFunc: cli.FilteredHelpFunc(included, cli.BasicHelpFunc("consul")),
|
||||
}
|
||||
|
||||
exitCode, err := cli.Run()
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
---
|
||||
layout: "docs"
|
||||
page_title: "Commands: ConfigTest"
|
||||
sidebar_current: "docs-commands-configtest"
|
||||
description: >
|
||||
The `consul configtest` command tests that config files are valid by
|
||||
attempting to parse them. Useful to ensure a configuration change will
|
||||
not cause consul to fail after a restart.
|
||||
---
|
||||
|
||||
# Consul ConfigTest
|
||||
|
||||
The `consul configtest` command performs a basic sanity test on Consul
|
||||
configuration files. For each file or directory given, the configtest command
|
||||
will attempt to parse the contents just as the "consul agent" command would,
|
||||
and catch any errors. This is useful to do a test of the configuration only,
|
||||
without actually starting the agent.
|
||||
|
||||
For more information on the format of Consul's configuration files, read the
|
||||
consul agent [Configuration Files](/docs/agent/options.html#configuration_files)
|
||||
section.
|
||||
|
||||
## Usage
|
||||
|
||||
Usage: `consul configtest [options]`
|
||||
|
||||
At least one `-config-file` or `-config-dir` parameter must be given. Returns 0
|
||||
if the configuration is valid, or 1 if there are problems. The list of
|
||||
available flags are:
|
||||
|
||||
* `-config-file` - Path to a config file. May be specified multiple times.
|
||||
|
||||
* `-config-dir` - Path to a directory of config files. All files ending in
|
||||
`.json` in the directory will be included. May be specified multiple times.
|
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
layout: "docs"
|
||||
page_title: "Commands: Validate"
|
||||
sidebar_current: "docs-commands-validate"
|
||||
description: >
|
||||
The `consul validate` command tests that config files are valid by
|
||||
attempting to parse them. Useful to ensure a configuration change will
|
||||
not cause consul to fail after a restart.
|
||||
---
|
||||
|
||||
# Consul Validate
|
||||
|
||||
The `consul validate` command performs a basic sanity test on Consul
|
||||
configuration files. For each file or directory given, the validate command
|
||||
will attempt to parse the contents just as the "consul agent" command would,
|
||||
and catch any errors. This is useful to do a test of the configuration only,
|
||||
without actually starting the agent.
|
||||
|
||||
For more information on the format of Consul's configuration files, read the
|
||||
consul agent [Configuration Files](/docs/agent/options.html#configuration_files)
|
||||
section.
|
||||
|
||||
## Usage
|
||||
|
||||
Usage: `consul validate [options] FILE_OR_DIRECTORY...`
|
||||
|
||||
Performs a basic sanity test on Consul configuration files. For each file
|
||||
or directory given, the validate command will attempt to parse the
|
||||
contents just as the "consul agent" command would, and catch any errors.
|
||||
This is useful to do a test of the configuration only, without actually
|
||||
starting the agent.
|
||||
|
||||
Returns 0 if the configuration is valid, or 1 if there are problems.
|
||||
|
||||
```text
|
||||
$ consul validate /etc/consul.d
|
||||
Configuration is valid!
|
||||
```
|
||||
|
|
@ -71,10 +71,6 @@
|
|||
<a href="/docs/commands/agent.html">agent</a>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-commands-configtest") %>>
|
||||
<a href="/docs/commands/configtest.html">configtest</a>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-commands-event") %>>
|
||||
<a href="/docs/commands/event.html">event</a>
|
||||
</li>
|
||||
|
@ -173,6 +169,11 @@
|
|||
</ul>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-commands-validate") %>>
|
||||
<a href="/docs/commands/validate.html">validate</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li<%= sidebar_current("docs-commands-version") %>>
|
||||
<a href="/docs/commands/version.html">version</a>
|
||||
</li>
|
||||
|
|
Loading…
Reference in New Issue