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
I disagree; having a configuration file in a fixed directory is common practice.
I would work in the direction to use also environment variables for a greater flexibility.
I disagree; having a configuration file in a fixed directory is common practice. I would work in the direction to use also environment variables for a greater flexibility.
I agree to use environment variables (and the config files that contain them). But I would add a command line option to just specify the path to an additional config file that overwrites the contents of the default one.
Now, if the agent doesn't find the configuration file in the fixed directory, it won't print any warnings or errors, resulting in a useless configuration like the one shown here. This can lead to some unpredictable behavior that is hard to understand. I would change this in two ways:
Add default values (taken from dfaasagent.envhere) as a configuration file to be embedded or in config.go using the Viper API,
Print the path of all configuration files read during startup in debug mode to know where and which files the agent is reading.
I also think that despite it's a common practice to have a fixed default directory where to load the env file / config file, it's good to have a parameter that can override the default location, which should be used only as default fallback (and the agent should or fail to start if no config file is found, or use all the default values / file with a warning).
Currently, when the DFaaS agent starts, it reads the configuration file (
dfaasagent.env
) from a fixed absolute directory called/agent
:dfaas/dfaasagent/agent/agent.go
Lines 233 to 234 in 3a9fc2b
Then, in
LoadConfig
of theconfig
package, it reads thedfaasagent.env
file:dfaas/dfaasagent/agent/config/config.go
Lines 63 to 79 in 3a9fc2b
It would be better to tell the agent where to read the configuration file, using the default path only as a fallback.
The text was updated successfully, but these errors were encountered: