summaryrefslogtreecommitdiff
path: root/Userland/Services/WebServer/Configuration.cpp
blob: 1a340fd78db2ea4c423239346f5268765695e6d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
 * 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;
}

}