summaryrefslogtreecommitdiff
path: root/config/src/config.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'config/src/config.cpp')
-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