diff --git a/include/cpputils/env_var.h b/include/cpputils/env_var.h index b3a85c1..e000f00 100644 --- a/include/cpputils/env_var.h +++ b/include/cpputils/env_var.h @@ -52,7 +52,7 @@ class EnvVarRegistry { }; }; -#define DEFINE_ENV_VAR_STRING(name, DEFAULT_VALUE, MIN_LEN) \ +#define DEFINE_ENV_VAR_STRING_LEN(name, DEFAULT_VALUE, MIN_LEN) \ namespace EnvVars { \ struct name { \ static constexpr char const* DEFAULT = DEFAULT_VALUE; \ @@ -60,7 +60,7 @@ class EnvVarRegistry { static char const* GET() { \ auto c = std::getenv(#name); \ if (c) { \ - if (std::strlen(c) > MIN_LEN) { \ + if (std::strlen(c) >= MIN_LEN) { \ return c; \ } \ } \ @@ -71,6 +71,9 @@ class EnvVarRegistry { }; \ } +#define DEFINE_ENV_VAR_STRING(name, DEFAULT_VALUE) \ + DEFINE_ENV_VAR_STRING_LEN(name, DEFAULT_VALUE, 1) + #define DEFINE_ENV_VAR_INT(TYPE, name, DEFAULT_VALUE) \ namespace EnvVars { \ struct name { \