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
The 'db-name: setting' in a config file does NOT override the setting within a 'shared' config file. This impacted me after making a setting change and then doing a -cd to clear the database. It cleared the wrong database.
sebastienvercammen
changed the title
'Db-name' is not adhered to in the -cf config file if also listed in the shared config file
Regular config file doesn't always take precedence over shared config file.
Jan 18, 2018
Updated title to reflect that this isn't about db-name specifically. The order of priority for config items doesn't seem to be consistent for all items: some get precedence, others don't, and CLI arg priority (-cf vs -scf) might affect it as well.
Since we've defined the shared config file as a config file for the ConfigArgParse library, the load order isn't controlled by us.
Logic summary from ConfigArgParse (quick examination):
Read command line args
Read ENV variables
unless they're already set, in which case they get ignored
Read config files (marked is_config_file=True) in reverse order to the order that they are declared in
unless they're already set, in which case they get ignored
Fill in any required but missing args with their default values
I'd guess that it's the combination of reversing the order and ignoring already set args that's caused the issue here.
In summary, ConfigArgParse doesn't appear to allow args to be overridden.
Quick addendum: there are subtleties here around some arg types - for example store_true and store_false are only considered 'set' if they are set to True or False respectively, i.e. if a store_true arg gets set to False in one config file it can still get set to True by another config file higher in the load order.
I found this at the following link:
The value set in the regular -cf configuration file takes precedence
https://github.com/RocketMap/RocketMap/blob/develop/docs/first-run/configuration-files.md
However, it doesn't work
Expected Behavior
The -cf configuration file should take precedence over the shared config file.
Current Behavior
The -cf does NOT take precedence over the shared config file for 'db-name'. I have heard this applies to other settings also.
Possible Solution
Steps to Reproduce (for bugs)
Context
Your Environment
The text was updated successfully, but these errors were encountered: