Inject server configuration instead of using a singleton
This commit is contained in:
@@ -65,11 +65,11 @@ void ConnectionOperator::HandleNewConnection(ClientSocket const & newClient)
|
||||
newClient.WriteBytes(bytesToSend);
|
||||
}
|
||||
|
||||
ConnectionOperator::ConnectionOperator(Logger & _logger)
|
||||
ConnectionOperator::ConnectionOperator(Logger & _logger, ServerConfiguration const & serverConfiguration)
|
||||
: logger(_logger)
|
||||
{
|
||||
// Base static file server
|
||||
auto const & staticFileRoot = ServerConfiguration::GetInstance().GetWwwRoot();
|
||||
auto const & staticFileRoot = serverConfiguration.GetWwwRoot();
|
||||
if (staticFileRoot.size() > 0)
|
||||
{
|
||||
middlewares.emplace_back(std::make_unique<Middleware::StaticContent>(_logger, staticFileRoot));
|
||||
|
||||
Reference in New Issue
Block a user