Settings: Add bool get()
This commit is contained in:
parent
eca29bd72d
commit
d37d012774
4 changed files with 13 additions and 3 deletions
|
@ -108,7 +108,7 @@ int main(int argc, char * * argv)
|
||||||
|
|
||||||
/* Pass on the location of the daemon client's SSH
|
/* Pass on the location of the daemon client's SSH
|
||||||
authentication socket. */
|
authentication socket. */
|
||||||
string sshAuthSock = settings.get("ssh-auth-sock", "");
|
string sshAuthSock = settings.get("ssh-auth-sock", string(""));
|
||||||
if (sshAuthSock != "") setenv("SSH_AUTH_SOCK", sshAuthSock.c_str(), 1);
|
if (sshAuthSock != "") setenv("SSH_AUTH_SOCK", sshAuthSock.c_str(), 1);
|
||||||
|
|
||||||
string host = settings.sshSubstituterHosts.front();
|
string host = settings.sshSubstituterHosts.front();
|
||||||
|
|
|
@ -1792,8 +1792,8 @@ void DerivationGoal::startBuilder()
|
||||||
|
|
||||||
/* Bind-mount a user-configurable set of directories from the
|
/* Bind-mount a user-configurable set of directories from the
|
||||||
host file system. */
|
host file system. */
|
||||||
PathSet dirs = tokenizeString<StringSet>(settings.get("build-chroot-dirs", DEFAULT_CHROOT_DIRS));
|
PathSet dirs = tokenizeString<StringSet>(settings.get("build-chroot-dirs", string(DEFAULT_CHROOT_DIRS)));
|
||||||
PathSet dirs2 = tokenizeString<StringSet>(settings.get("build-extra-chroot-dirs", ""));
|
PathSet dirs2 = tokenizeString<StringSet>(settings.get("build-extra-chroot-dirs", string("")));
|
||||||
dirs.insert(dirs2.begin(), dirs2.end());
|
dirs.insert(dirs2.begin(), dirs2.end());
|
||||||
for (auto & i : dirs) {
|
for (auto & i : dirs) {
|
||||||
size_t p = i.find('=');
|
size_t p = i.find('=');
|
||||||
|
|
|
@ -136,6 +136,14 @@ Strings Settings::get(const string & name, const Strings & def)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Settings::get(const string & name, bool def)
|
||||||
|
{
|
||||||
|
bool res = def;
|
||||||
|
_get(res, name);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Settings::update()
|
void Settings::update()
|
||||||
{
|
{
|
||||||
_get(tryFallback, "build-fallback");
|
_get(tryFallback, "build-fallback");
|
||||||
|
|
|
@ -25,6 +25,8 @@ struct Settings {
|
||||||
|
|
||||||
Strings get(const string & name, const Strings & def);
|
Strings get(const string & name, const Strings & def);
|
||||||
|
|
||||||
|
bool get(const string & name, bool def);
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
string pack();
|
string pack();
|
||||||
|
|
Loading…
Reference in a new issue