Skip to content

Commit

Permalink
Set string config variables that don’t contain $set.
Browse files Browse the repository at this point in the history
  • Loading branch information
dillof committed Jun 26, 2024
1 parent 3ae778e commit d84855d
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/Configuration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -642,19 +642,25 @@ void Configuration::set_bool_optional(const toml::table &table, const std::strin

void Configuration::set_string(const toml::table &table, const std::string &name, std::string &variable) {
auto value = table[name].value<std::string>();
if (value.has_value()) {
if (!set.empty() || value.value().find("$set") == std::string::npos) {
variable = replace_variables(value.value());
if (value) {
if ((*value).find("$set") == std::string::npos) {
variable = *value;
}
else if (!set.empty()) {
variable = replace_variables(*value);
}
}
}


void Configuration::set_string_optional(const toml::table &table, const std::string &name, std::optional<std::string> &variable){
auto value = table[name].value<std::string>();
if (value.has_value()) {
if (!set.empty() || value.value().find("$set") == std::string::npos) {
variable = replace_variables(value.value());
if (value) {
if ((*value).find("$set") == std::string::npos) {
variable = *value;
}
else if (!set.empty()) {
variable = replace_variables(*value);
}
}
}
Expand Down

0 comments on commit d84855d

Please sign in to comment.