mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +00:00
WebServer: Require document root and credentials as config init params
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.
This commit is contained in:
parent
bb91857885
commit
5d305845e3
3 changed files with 9 additions and 9 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Max Wipfli <mail@maxwipfli.ch>
|
||||
* Copyright (c) 2022, Thomas Keppler <serenity@tkeppler.de>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -14,14 +15,11 @@ namespace WebServer {
|
|||
|
||||
class Configuration {
|
||||
public:
|
||||
Configuration(DeprecatedString document_root_path);
|
||||
Configuration(DeprecatedString document_root_path, Optional<HTTP::HttpRequest::BasicAuthenticationCredentials> credentials = {});
|
||||
|
||||
DeprecatedString const& document_root_path() const { return m_document_root_path; }
|
||||
Optional<HTTP::HttpRequest::BasicAuthenticationCredentials> const& credentials() const { return m_credentials; }
|
||||
|
||||
void set_document_root_path(DeprecatedString root_path) { m_document_root_path = move(root_path); }
|
||||
void set_credentials(Optional<HTTP::HttpRequest::BasicAuthenticationCredentials> credentials) { m_credentials = move(credentials); }
|
||||
|
||||
static Configuration const& the();
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue