Configuration.cpp 669 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * Copyright (c) 2021, Max Wipfli <mail@maxwipfli.ch>
  3. * Copyright (c) 2022, Thomas Keppler <serenity@tkeppler.de>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #include <WebServer/Configuration.h>
  8. namespace WebServer {
  9. static Configuration* s_configuration = nullptr;
  10. Configuration::Configuration(String document_root_path, Optional<HTTP::HttpRequest::BasicAuthenticationCredentials> credentials)
  11. : m_document_root_path(move(document_root_path))
  12. , m_credentials(move(credentials))
  13. {
  14. VERIFY(!s_configuration);
  15. s_configuration = this;
  16. }
  17. Configuration const& Configuration::the()
  18. {
  19. VERIFY(s_configuration);
  20. return *s_configuration;
  21. }
  22. }