2015-05-04 18:41:19 +00:00
|
|
|
---
|
|
|
|
layout: "docs"
|
|
|
|
page_title: "Commands: ConfigTest"
|
|
|
|
sidebar_current: "docs-commands-configtest"
|
2015-05-11 16:42:06 +00:00
|
|
|
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.
|
2015-05-04 18:41:19 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# Consul ConfigTest
|
|
|
|
|
2015-05-11 16:42:06 +00:00
|
|
|
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.
|
2015-05-04 18:41:19 +00:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
Usage: `consul configtest [options]`
|
|
|
|
|
2015-09-11 19:24:54 +00:00
|
|
|
At least one `-config-file` or `-config-dir` parameter must be given. Returns 0
|
2015-05-11 16:42:06 +00:00
|
|
|
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.
|