Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3531116
D3970.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D3970.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D3970: [services] Add hasEnvFlag
Attached
Detach File
Event Timeline
Log In to Comment