3#include "../core/controller.hpp"
4#include "../core/detail/controller_run_result.hpp"
5#include "../server/listener.hpp"
6#include "../server/routing/router.hpp"
12namespace boost::asio::ssl
17namespace malloy::server
48 std::string
interface = "127.0.0.1";
78 #if MALLOY_FEATURE_TLS
89 init_tls(
const std::filesystem::path& cert_path,
const std::filesystem::path& key_path);
101 init_tls(
const std::string& cert,
const std::string& key);
133 #if MALLOY_FEATURE_TLS
134 std::unique_ptr<boost::asio::ssl::context> m_tls_ctx;
137 [[nodiscard(
"ignoring result will cause the server to instantly stop")]]
143 ctrl.m_cfg.logger->debug(
"starting server.");
144 auto ioc = std::make_unique<boost::asio::io_context>();
147 auto l = std::make_shared<malloy::server::listener>(
148 ctrl.m_cfg.logger->clone(
"listener"),
149 ctrl.m_cfg.connection_logger,
151#
if MALLOY_FEATURE_TLS
152 std::move(ctrl.m_tls_ctx),
156 boost::asio::ip::tcp::endpoint{boost::asio::ip::make_address(ctrl.m_cfg.interface), ctrl.m_cfg.port},
157 std::make_shared<class router>(std::move(ctrl.m_router)),
158 std::make_shared<std::filesystem::path>(ctrl.m_cfg.doc_root),
159 ctrl.m_cfg.agent_string);
163 return session{ctrl.m_cfg, std::move(l), std::move(ioc)};
167 auto start(routing_context&&) -> routing_context::session;
Definition: controller_run_result.hpp:42
Definition: router.hpp:104
A high-level controller.
Definition: routing_context.hpp:30
bool init_tls(const std::filesystem::path &cert_path, const std::filesystem::path &key_path)
Definition: routing_context.cpp:28
constexpr const malloy::server::router & router() const noexcept
Definition: routing_context.hpp:112
constexpr malloy::server::router & router() noexcept
Definition: routing_context.hpp:125
Definition: controller_run_result.hpp:19
Definition: routing_context.hpp:39
std::filesystem::path doc_root
Definition: routing_context.hpp:61
std::uint16_t port
Definition: routing_context.hpp:53
std::shared_ptr< spdlog::logger > connection_logger
Definition: routing_context.hpp:43
std::string agent_string
Agent string used for connections.
Definition: routing_context.hpp:67