11 #define LOG_TAG "config_env"
13 static char* configvar_raw(
char* varname)
15 char* val = getenv(varname);
18 LOGE(
"No envvar %s", varname);
23 LOGE(
"Envvar %s is empty", varname);
31 char* val = configvar_raw(varname);
32 LOGD(
"%s: %s", varname, val);
39 char* val = configvar_raw(varname);
41 LOGD(
"%s: %d", varname, ret);
48 char* val = configvar_raw(varname);
50 if (yn ==
'y' || yn ==
'Y' || yn ==
'1')
54 else if (yn !=
'n' && yn !=
'N' && yn !=
'0')
56 LOGE(
"%s: value must start with (y|n|0|1), was %s", varname, val);
59 LOGD(
"%s: %d", varname, ret);
Utilities to get config values from the environment.
#define LOGD(...)
Log at DEBUG level.
#define LOGE(...)
Log at ERROR level (makes the application abort)
char * configvar_string(char *varname)
Get the value of a config variable from the env.
int configvar_bool(char *varname)
Get the value of a boolean config variable from the env.
int configvar_int(char *varname)
Get the value of a integer config variable from the env.