Aria
3.2.6
C++23 MVVM framework — 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
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
export.hpp
ARIA_HTTP_API
#define ARIA_HTTP_API
Definition
export.hpp:83
aria::adapters::http
Definition
http_adapter.hpp:71
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:88
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:58
aria::adapters::http::HttpAdapterConfig::tls_key_file
std::string tls_key_file
Server private key (PEM). Empty = no TLS.
Definition
http_config.hpp:91
aria::adapters::http::HttpAdapterConfig::enable_cors
bool enable_cors
Enable CORS headers (Access-Control-Allow-Origin: *).
Definition
http_config.hpp:63
aria::adapters::http::HttpAdapterConfig::tls_ca_file
std::string tls_ca_file
Optional CA bundle for verifying client certificates (mTLS).
Definition
http_config.hpp:95
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:100
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 batch currently being written t...
Definition
http_config.hpp:53
modules
adapters
http
include
aria
adapters
http
http_config.hpp
Generated by
1.18.0