Aria
2.0.0
C++23 MVVM framework (C++20 minimum) — reactive, coroutine-first, ABI-layered
Toggle main menu visibility
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
11
namespace
aria::adapters::http
{
12
15
struct
ARIA_HTTP_API
HttpAdapterConfig
{
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
37
int
worker_threads
{0};
38
41
int
heartbeat_sec
{25};
42
46
int
max_sse_clients
{64};
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
export.hpp
ARIA_HTTP_API
#define ARIA_HTTP_API
Definition
export.hpp:66
aria::adapters::http
Definition
http_adapter.hpp:67
aria::adapters::http::HttpAdapterConfig
Configuration for HttpAdapter.
Definition
http_config.hpp:15
aria::adapters::http::HttpAdapterConfig::port
std::uint16_t port
TCP port.
Definition
http_config.hpp:23
aria::adapters::http::HttpAdapterConfig::api_prefix
std::string api_prefix
Path prefix for REST endpoints.
Definition
http_config.hpp:27
aria::adapters::http::HttpAdapterConfig::tls_cert_file
std::string tls_cert_file
Server certificate (PEM).
Definition
http_config.hpp:87
aria::adapters::http::HttpAdapterConfig::static_root
std::string static_root
Optional static-file root.
Definition
http_config.hpp:32
aria::adapters::http::HttpAdapterConfig::max_pending_notifications
std::size_t max_pending_notifications
Maximum queued state/click notification batches (must be positive).
Definition
http_config.hpp:57
aria::adapters::http::HttpAdapterConfig::tls_key_file
std::string tls_key_file
Server private key (PEM). Empty = no TLS.
Definition
http_config.hpp:90
aria::adapters::http::HttpAdapterConfig::enable_cors
bool enable_cors
Enable CORS headers (Access-Control-Allow-Origin: *).
Definition
http_config.hpp:62
aria::adapters::http::HttpAdapterConfig::tls_ca_file
std::string tls_ca_file
Optional CA bundle for verifying client certificates (mTLS).
Definition
http_config.hpp:94
aria::adapters::http::HttpAdapterConfig::heartbeat_sec
int heartbeat_sec
Heartbeat interval (seconds) for SSE keep-alive pings.
Definition
http_config.hpp:41
aria::adapters::http::HttpAdapterConfig::worker_threads
int worker_threads
Worker thread count for the HTTP server.
Definition
http_config.hpp:37
aria::adapters::http::HttpAdapterConfig::host
std::string host
Bind address.
Definition
http_config.hpp:19
aria::adapters::http::HttpAdapterConfig::tls_min_version
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
aria::adapters::http::HttpAdapterConfig::max_sse_clients
int max_sse_clients
Maximum number of concurrent SSE clients.
Definition
http_config.hpp:46
aria::adapters::http::HttpAdapterConfig::max_pending_sse_bytes
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
modules
adapters
http
include
aria
adapters
http
http_config.hpp
Generated by
1.18.0