static bool
handle_conf_setting(struct conf *conf, const char *key, const char *value,
- char **errmsg)
+ char **errmsg, bool from_env_variable)
{
const struct conf_item *item;
return false;
}
+ if (from_env_variable && item->parser == parse_bool) {
+ /*
+ * Special rule for boolean settings from the environment: any value means
+ * true.
+ */
+ bool *value = (bool *)((void *)conf + item->offset);
+ *value = true;
+ return true;
+ }
+
if (!item->parser(value, (void *)conf + item->offset, errmsg)) {
return false;
}
#undef SKIP_WS
- result = handle_conf_setting(conf, key, value, errmsg);
+ result = handle_conf_setting(conf, key, value, errmsg, false);
free(key);
free(value);
continue;
}
- if (!handle_conf_setting(conf, env_to_conf_item->conf_name, q, &errmsg2)) {
+ if (!handle_conf_setting(
+ conf, env_to_conf_item->conf_name, q, &errmsg2, true)) {
*errmsg = format("%s: %s", key, errmsg2);
free(errmsg2);
free(key);