Begin removing several dependencies on Config object

This commit is contained in:
2019-09-29 17:12:36 +02:00
parent 327c0793d1
commit 364d82a99f
9 changed files with 127 additions and 79 deletions

View File

@@ -24,5 +24,16 @@ SOFTWARE.
std::unique_ptr<GatewayInterface> createGateway(const Config &c)
{
return std::make_unique<HttpGateway>(c);
std::string listenaddr = c.configVarResolver.getConfig("http.listenaddr");
if(listenaddr.empty())
{
throw new std::runtime_error("No http.listenaddr in config file");
}
std::string listenport = c.configVarResolver.getConfig("http.listenport");
if(listenport.empty())
{
throw new std::runtime_error("No http.listenport in config file");
}
return std::make_unique<HttpGateway>(listenaddr, std::stoi(listenport), c.max_payload_length);
}