Aria 3.2.6
C++23 MVVM framework — 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
53 std::size_t max_pending_sse_bytes{4 * 1024 * 1024};
54
58 std::size_t max_pending_notifications{1024};
59
63 bool enable_cors{false};
64
65 // ── TLS (HTTPS) ──────────────────────────────────────────────────
66 //
67 // When `tls_cert_file` and `tls_key_file` are both non-empty AND
68 // the adapter was built with `ARIA_HTTP_ENABLE_TLS=ON` (which links
69 // OpenSSL statically — see cmake/BuildOpenSSL.cmake), the server
70 // serves HTTPS instead of plain HTTP. Both endpoints (REST and
71 // SSE) move to TLS.
72 //
73 // Set BOTH cert and key paths to PEM files. Optionally set
74 // `tls_ca_file` to require client certificate verification (mTLS).
75 // Set `tls_min_version` to enforce a minimum TLS version
76 // ("1.2" or "1.3"; default is "1.2" — TLS 1.0/1.1 are always
77 // refused).
78 //
79 // For local development you can quickly mint a self-signed cert:
80 //
81 // openssl req -x509 -newkey rsa:2048 -nodes -keyout key.pem
82 // -out cert.pem -days 365 -subj "/CN=localhost"
83 //
84 // For production, use a real CA-issued cert (Let's Encrypt etc.).
85
88 std::string tls_cert_file{};
89
91 std::string tls_key_file{};
92
95 std::string tls_ca_file{};
96
100 std::string tls_min_version{"1.2"};
101};
102
103} // namespace aria::adapters::http
#define ARIA_HTTP_API
Definition export.hpp:83
Definition http_adapter.hpp:71
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:88
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:58
std::string tls_key_file
Server private key (PEM). Empty = no TLS.
Definition http_config.hpp:91
bool enable_cors
Enable CORS headers (Access-Control-Allow-Origin: *).
Definition http_config.hpp:63
std::string tls_ca_file
Optional CA bundle for verifying client certificates (mTLS).
Definition http_config.hpp:95
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:100
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 batch currently being written t...
Definition http_config.hpp:53