Page MenuHomePhabricator

D3970.diff
No OneTemporary

D3970.diff

diff --git a/services/lib/src/GlobalTools.h b/services/lib/src/GlobalTools.h
--- a/services/lib/src/GlobalTools.h
+++ b/services/lib/src/GlobalTools.h
@@ -8,6 +8,8 @@
uint64_t getCurrentTimestamp();
+bool hasEnvFlag(const std::string &flag);
+
std::string decorateTableName(const std::string &baseName);
bool isDevMode();
diff --git a/services/lib/src/GlobalTools.cpp b/services/lib/src/GlobalTools.cpp
--- a/services/lib/src/GlobalTools.cpp
+++ b/services/lib/src/GlobalTools.cpp
@@ -15,20 +15,23 @@
.count();
}
+bool hasEnvFlag(const std::string &flag) {
+ if (std::getenv(flag.c_str()) == nullptr) {
+ return false;
+ }
+ return std::string(std::getenv(flag.c_str())) == "1";
+}
+
std::string decorateTableName(const std::string &baseName) {
std::string suffix = "";
- if (std::getenv("COMM_TEST_SERVICES") != nullptr &&
- std::string(std::getenv("COMM_TEST_SERVICES")) == "1") {
+ if (hasEnvFlag("COMM_TEST_SERVICES")) {
suffix = "-test";
}
return baseName + suffix;
}
bool isDevMode() {
- if (std::getenv("COMM_SERVICES_DEV_MODE") == nullptr) {
- return false;
- }
- return std::string(std::getenv("COMM_SERVICES_DEV_MODE")) == "1";
+ return hasEnvFlag("COMM_SERVICES_DEV_MODE");
}
} // namespace network

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 26, 6:05 AM (12 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2704034
Default Alt Text
D3970.diff (1 KB)

Event Timeline