From 15ab670d4a295138900981a1cc5c2cc48b80c2e5 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 22 May 2020 16:11:24 +0800 Subject: [PATCH] 1 --- cpp/utils.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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)