From 303322d4ca2db1aa2eb8679efc08f3a10dea3d40 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Tue, 14 Sep 2021 20:35:46 +0200 Subject: [PATCH] config: throw exception on non-existing environment variables --- lib/config.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/config.cpp b/lib/config.cpp index bdb25d447..b2bc9e795 100644 --- a/lib/config.cpp +++ b/lib/config.cpp @@ -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);