summaryrefslogtreecommitdiff
path: root/common/src/internal.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/src/internal.cpp')
-rw-r--r--common/src/internal.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/common/src/internal.cpp b/common/src/internal.cpp
new file mode 100644
index 0000000..de1e7b0
--- /dev/null
+++ b/common/src/internal.cpp
@@ -0,0 +1,27 @@
+#include "hwd/internal.h"
+
+#include <cstdlib>
+
+
+namespace hwd
+{
+namespace internal
+{
+
+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 internal
+} // namespace hwd