diff --git a/cpp/utils.cc b/cpp/utils.cc index 38255a2..bbe2b56 100644 --- a/cpp/utils.cc +++ b/cpp/utils.cc @@ -5,6 +5,7 @@ #include #include #include +#include #include @@ -351,13 +352,14 @@ namespace f8 bool IsOnlineEnv() { - return !getenv("SERVER_ENV"); + static bool is_online = !getenv("SERVER_ENV"); + return is_online; } bool IsTestEnv() { - char* env = getenv("SERVER_ENV"); - return std::string(env) == "TEST"; + static bool is_test = a8::SafeStrCmp(getenv("SERVER_ENV"), "TEST") == 0; + return is_test; } bool IsValidNormalConfig(a8::XObject& conf, std::vector fields)