summaryrefslogtreecommitdiff
path: root/config/src
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-06-07 16:54:43 +0200
committerAki <please@ignore.pl>2022-06-07 16:54:43 +0200
commitb9e96d1b28eb5fa69f5c8e572e13695669354b23 (patch)
tree8f47178c46048b77d22fa4b0d92762a53f911c65 /config/src
parentbf0ff8b3ae273ba52a79ff3952cf103f5ed131e3 (diff)
downloadhwd-b9e96d1b28eb5fa69f5c8e572e13695669354b23.zip
hwd-b9e96d1b28eb5fa69f5c8e572e13695669354b23.tar.gz
hwd-b9e96d1b28eb5fa69f5c8e572e13695669354b23.tar.bz2
Renamed internal common to config
Diffstat (limited to 'config/src')
-rw-r--r--config/src/config.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/config/src/config.cpp b/config/src/config.cpp
new file mode 100644
index 0000000..8895a24
--- /dev/null
+++ b/config/src/config.cpp
@@ -0,0 +1,27 @@
+#include "hwd/config.h"
+
+#include <cstdlib>
+
+
+namespace hwd
+{
+namespace config
+{
+
+int port()
+{
+ if (const char * from_env = std::getenv(port_variable))
+ if (int port_number = std::atoi(from_env))
+ return port_number;
+ return default_port;
+}
+
+const char * host()
+{
+ if (const char * from_env = std::getenv(host_variable))
+ return from_env;
+ return default_host;
+}
+
+} // namespace config
+} // namespace hwd