diff options
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/globals.cc | 12 | ||||
-rw-r--r-- | src/libstore/globals.hh | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc index 296cc4ac8029..907627b6591c 100644 --- a/src/libstore/globals.cc +++ b/src/libstore/globals.cc @@ -34,6 +34,9 @@ static bool settingsRead = false; static std::map<string, Strings> settings; +/* Overriden settings. */ +std::map<string, Strings> settingsCmdline; + string & at(Strings & ss, unsigned int n) { @@ -73,6 +76,8 @@ static void readSettings() advance(i, 2); settings[name] = Strings(i, tokens.end()); }; + + settings.insert(settingsCmdline.begin(), settingsCmdline.end()); settingsRead = true; } @@ -118,6 +123,13 @@ unsigned int queryIntSetting(const string & name, unsigned int def) } +void overrideSetting(const string & name, const Strings & value) +{ + if (settingsRead) settings[name] = value; + settingsCmdline[name] = value; +} + + void reloadSettings() { settingsRead = false; diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh index b8e2bae66e65..687247cc74f4 100644 --- a/src/libstore/globals.hh +++ b/src/libstore/globals.hh @@ -101,6 +101,8 @@ bool queryBoolSetting(const string & name, bool def); unsigned int queryIntSetting(const string & name, unsigned int def); +void overrideSetting(const string & name, const Strings & value); + void reloadSettings(); |