hashicorp / hashicorp/consul-template
Option once in a config file is not respected.
- Dominant language
- Go
- Stars
- 4.8k
- Forks
- 801
- Avg merge
- 4h 5m
- Merged PRs (30d)
- 6
Description
Config options like `-once` are not respected if set in a config file as they are always overwritten by their values (default or explicitly given) coming from the command line option. This makes their use in a config file meaningless.
For example for file consul-config-true.hcl:
```
...
once = true
...
```
running
`
consule-template -config consul.config-true.hcl
`
will not take into account `once = true` set in the config file even though there isn't an explicitly set `-once=false` as a command line argument. In order for this to work any such flags if not specified explicitly in the command line should be set to `nil` first and at the end of constructing the config should be set to its default value (`false`) only if it is still `nil` then.
This most likely applies to other such options but I've tested this only with `-once`.
Still not sure whether this is a bug or the intended behavior even though then `once` is meaningful only as a command line flag and not in a config file.
Contributor guide
Research direction
Start by tracing how the config file and command-line options are combined, using the reported `consul-config-true.hcl` example and the `-config` and `-once` entry points. Reproduce the command, then verify that `once = true` from the file is honored when `-once` is absent while an explicit command-line value still overrides it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100