mirror of
https://github.com/caddyserver/caddy.git
synced 2025-05-29 23:25:50 +08:00
cmd: Add --envfile
flag to validate
command (#5350)
Fixes https://github.com/caddyserver/caddy/issues/5346
This commit is contained in:
@ -287,16 +287,20 @@ zero exit status will be returned.`,
|
||||
RegisterCommand(Command{
|
||||
Name: "validate",
|
||||
Func: cmdValidateConfig,
|
||||
Usage: "--config <path> [--adapter <name>]",
|
||||
Usage: "--config <path> [--adapter <name>] [--envfile <path>]",
|
||||
Short: "Tests whether a configuration file is valid",
|
||||
Long: `
|
||||
Loads and provisions the provided config, but does not start running it.
|
||||
This reveals any errors with the configuration through the loading and
|
||||
provisioning stages.`,
|
||||
provisioning stages.
|
||||
|
||||
If --envfile is specified, an environment file with environment variables in
|
||||
the KEY=VALUE format will be loaded into the Caddy process.`,
|
||||
Flags: func() *flag.FlagSet {
|
||||
fs := flag.NewFlagSet("validate", flag.ExitOnError)
|
||||
fs.String("config", "", "Input configuration file")
|
||||
fs.String("adapter", "", "Name of config adapter")
|
||||
fs.String("envfile", "", "Environment file to load")
|
||||
return fs
|
||||
}(),
|
||||
})
|
||||
|
Reference in New Issue
Block a user