mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-11 01:06:01 +03:00
e77ca79897
This moves the configuration of the web server, which currently only consists of the root path, into a new class, Configuration. Since the configuration is global and not per client, it is accessed by a singleton getter. This change simplifies future extensions of the configurable parameters.
27 lines
469 B
C++
27 lines
469 B
C++
/*
|
|
* Copyright (c) 2021, Max Wipfli <mail@maxwipfli.ch>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <WebServer/Configuration.h>
|
|
|
|
namespace WebServer {
|
|
|
|
static Configuration* s_configuration = nullptr;
|
|
|
|
Configuration::Configuration(String root_path)
|
|
: m_root_path(move(root_path))
|
|
{
|
|
VERIFY(!s_configuration);
|
|
s_configuration = this;
|
|
}
|
|
|
|
Configuration const& Configuration::the()
|
|
{
|
|
VERIFY(s_configuration);
|
|
return *s_configuration;
|
|
}
|
|
|
|
}
|