Aria 2.0.0
C++23 MVVM framework (C++20 minimum) — reactive, coroutine-first, ABI-layered
Loading...
Searching...
No Matches
http_config.hpp
Go to the documentation of this file.
1#pragma once
4
5#include "aria/abi/export.hpp"
6
7#include <cstddef>
8#include <cstdint>
9#include <string>
10
11namespace aria::adapters::http {
12
19 std::string host{"127.0.0.1"};
20
23 std::uint16_t port{9090};
24
27 std::string api_prefix{"/aria"};
28
32 std::string static_root{};
33
38
42
47
52 std::size_t max_pending_sse_bytes{4 * 1024 * 1024};
53
57 std::size_t max_pending_notifications{1024};
58
62 bool enable_cors{false};
63
64 // ── TLS (HTTPS) ──────────────────────────────────────────────────
65 //
66 // When `tls_cert_file` and `tls_key_file` are both non-empty AND
67 // the adapter was built with `ARIA_HTTP_ENABLE_TLS=ON` (which links
68 // OpenSSL statically — see cmake/BuildOpenSSL.cmake), the server
69 // serves HTTPS instead of plain HTTP. Both endpoints (REST and
70 // SSE) move to TLS.
71 //
72 // Set BOTH cert and key paths to PEM files. Optionally set
73 // `tls_ca_file` to require client certificate verification (mTLS).
74 // Set `tls_min_version` to enforce a minimum TLS version
75 // ("1.2" or "1.3"; default is "1.2" — TLS 1.0/1.1 are always
76 // refused).
77 //
78 // For local development you can quickly mint a self-signed cert:
79 //
80 // openssl req -x509 -newkey rsa:2048 -nodes -keyout key.pem
81 // -out cert.pem -days 365 -subj "/CN=localhost"
82 //
83 // For production, use a real CA-issued cert (Let's Encrypt etc.).
84
87 std::string tls_cert_file{};
88
90 std::string tls_key_file{};
91
94 std::string tls_ca_file{};
95
99 std::string tls_min_version{"1.2"};
100};
101
102} // namespace aria::adapters::http
#define ARIA_HTTP_API
Definition export.hpp:66
Definition http_adapter.hpp:67
Configuration for HttpAdapter.
Definition http_config.hpp:15
std::uint16_t port
TCP port.
Definition http_config.hpp:23
std::string api_prefix
Path prefix for REST endpoints.
Definition http_config.hpp:27
std::string tls_cert_file
Server certificate (PEM).
Definition http_config.hpp:87
std::string static_root
Optional static-file root.
Definition http_config.hpp:32
std::size_t max_pending_notifications
Maximum queued state/click notification batches (must be positive).
Definition http_config.hpp:57
std::string tls_key_file
Server private key (PEM). Empty = no TLS.
Definition http_config.hpp:90
bool enable_cors
Enable CORS headers (Access-Control-Allow-Origin: *).
Definition http_config.hpp:62
std::string tls_ca_file
Optional CA bundle for verifying client certificates (mTLS).
Definition http_config.hpp:94
int heartbeat_sec
Heartbeat interval (seconds) for SSE keep-alive pings.
Definition http_config.hpp:41
int worker_threads
Worker thread count for the HTTP server.
Definition http_config.hpp:37
std::string host
Bind address.
Definition http_config.hpp:19
std::string tls_min_version
Minimum TLS version: "1.2" (default, broad compat) or "1.3" (modern, recommended for new deployments)...
Definition http_config.hpp:99
int max_sse_clients
Maximum number of concurrent SSE clients.
Definition http_config.hpp:46
std::size_t max_pending_sse_bytes
Maximum queued SSE bytes per client (must be positive), excluding the single frame currently being wr...
Definition http_config.hpp:52