You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allowing configuration of the CLI via a config file would not only allow for more expressive config parameters, but also be easier for generating and distributing.
Since the CLI uses the api package SDK, the api package should honor all non-CLI-flag configuration files listed below.
Note there are no tokens or other secrets in the config file.
Mixing CLI and Agent configuration in a single file is not supported. This would encourage sharing the tls{} block between the CLI and Agent, and the CLI should not use the same certificates as the Agent.
The CLI should output a warning when encountering a config file with client{} or server{} blocks in it.
Agents should log a warning when encountering a config file with a cli{} block as this may indicate a misunderstanding or misconfiguration.
File Resolution Order
As with Nomad Agent configuration file parsing, the CLI should parse and combine multiple config files. The precedence is (so parsing should be done in reverse order):
Specific CLI flags (e.g. -address)
Specific environment variables (e.g. NOMAD_ADDR)
-config CLI flag
NOMAD_CLI_CONF environment variable
.nomad.{json,hcl} in the current directory
$HOME/.config/nomad/config.{json,hcl} on Unix or %APPDATA%\nomad\config.{json,hcl} on Windows
Proposal
As of Nomad v1.9 the CLI is only configurable via environment variables: https://developer.hashicorp.com/nomad/docs/commands#environment-variables
Allowing configuration of the CLI via a config file would not only allow for more expressive config parameters, but also be easier for generating and distributing.
Since the CLI uses the
api
package SDK, theapi
package should honor all non-CLI-flag configuration files listed below.Parameters
address
- Same asNOMAD_ADDR
/-address
region
- Same asNOMAD_REGION
/-region
namespace
- Same asNOMAD_NAMESPACE
/-namespace
tls{}
- Same as agent's for relevant settingsunsafe_skip_verify
- Same asNOMAD_SKIP_VERIFY
cli{}
no_color
- Same asNOMAD_CLI_NO_COLOR
Note there are no tokens or other secrets in the config file.
Mixing CLI and Agent configuration in a single file is not supported. This would encourage sharing the
tls{}
block between the CLI and Agent, and the CLI should not use the same certificates as the Agent.The CLI should output a warning when encountering a config file with
client{}
orserver{}
blocks in it.Agents should log a warning when encountering a config file with a
cli{}
block as this may indicate a misunderstanding or misconfiguration.File Resolution Order
As with Nomad Agent configuration file parsing, the CLI should parse and combine multiple config files. The precedence is (so parsing should be done in reverse order):
-address
)-config
CLI flagNOMAD_CLI_CONF
environment variable.nomad.{json,hcl}
in the current directory$HOME/.config/nomad/config.{json,hcl}
on Unix or%APPDATA%\nomad\config.{json,hcl}
on WindowsPrior Art
@jrasell did a hackweek project on CLI contexts: main...jrasell/hack-context
See also internal RFC NMD-156
External
Use-cases
The text was updated successfully, but these errors were encountered: