mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 14:05:15 +00:00
Now, there is nothing that can react to `set_...()` calls, so offering this possibility can cause wrong assumptions as to what one can do as soon as a WebServer instance has launched. The main program can still decide whether to supply the optional credentials or not, but this way, the configuration can become a Value Object that won't change after initial creation.
28 lines
679 B
C++
28 lines
679 B
C++
/*
|
|
* Copyright (c) 2021, Max Wipfli <mail@maxwipfli.ch>
|
|
* Copyright (c) 2022, Thomas Keppler <serenity@tkeppler.de>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <WebServer/Configuration.h>
|
|
|
|
namespace WebServer {
|
|
|
|
static Configuration* s_configuration = nullptr;
|
|
|
|
Configuration::Configuration(DeprecatedString document_root_path, Optional<HTTP::HttpRequest::BasicAuthenticationCredentials> credentials)
|
|
: m_document_root_path(move(document_root_path))
|
|
, m_credentials(move(credentials))
|
|
{
|
|
VERIFY(!s_configuration);
|
|
s_configuration = this;
|
|
}
|
|
|
|
Configuration const& Configuration::the()
|
|
{
|
|
VERIFY(s_configuration);
|
|
return *s_configuration;
|
|
}
|
|
|
|
}
|