Skip to content

Option once in a config file is not respected. #2100

Description

@TypeTheory

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions