1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

config: throw exception on non-existing environment variables

This commit is contained in:
Steffen Vogel 2021-09-14 20:35:46 +02:00
parent b83bec6f7d
commit 303322d4ca

View file

@ -244,6 +244,8 @@ json_t * Config::expandEnvVars(json_t *in)
auto const from = match[0];
auto const var_name = match[1].str().c_str();
char *var_value = std::getenv(var_name);
if (!var_value)
throw ConfigError(str, "node-config-envvars", "Unresolved environment variable: {}", var_name);
text.replace(from.first - text.begin(), from.second - from.first, var_value);