blob: 8895a248bb76300dcfe6d0c877e03c4c5e9f3491 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
|