ORE Studio 0.0.4
Loading...
Searching...
No Matches
http_server_options.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2025 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_HTTP_NET_HTTP_SERVER_OPTIONS_HPP
21#define ORES_HTTP_NET_HTTP_SERVER_OPTIONS_HPP
22
23#include <string>
24#include <cstdint>
25#include <chrono>
26#include <iosfwd>
27
28namespace ores::http::net {
29
33struct http_server_options final {
37 std::string address = "0.0.0.0";
38
42 std::uint16_t port = 8080;
43
47 std::uint32_t max_connections = 100;
48
52 std::chrono::seconds request_timeout{30};
53
57 bool enable_ssl = false;
58
62 std::string certificate_file;
63
67 std::string private_key_file;
68
72 std::string jwt_secret;
73
78
82 std::string jwt_issuer = "ores";
83
87 std::string jwt_audience = "ores-api";
88
92 bool enable_cors = true;
93
97 std::string cors_allowed_origins = "*";
98
102 std::string server_identifier = "ores-http-server";
103};
104
105std::ostream& operator<<(std::ostream& s, const http_server_options& v);
106
107}
108
109#endif
Configuration options for the HTTP server.
Definition http_server_options.hpp:33
std::chrono::seconds request_timeout
Request timeout duration.
Definition http_server_options.hpp:52
std::string certificate_file
Path to SSL certificate file.
Definition http_server_options.hpp:62
bool enable_cors
Enable CORS support.
Definition http_server_options.hpp:92
std::uint16_t port
Port to listen on.
Definition http_server_options.hpp:42
std::string jwt_secret
JWT secret for authentication (if using symmetric key).
Definition http_server_options.hpp:72
std::string jwt_audience
JWT audience for validation.
Definition http_server_options.hpp:87
std::string address
Address to bind to (default: 0.0.0.0).
Definition http_server_options.hpp:37
bool enable_ssl
Whether to enable SSL/TLS.
Definition http_server_options.hpp:57
std::string jwt_public_key_file
Path to JWT public key file (if using RSA).
Definition http_server_options.hpp:77
std::uint32_t max_connections
Maximum number of concurrent connections.
Definition http_server_options.hpp:47
std::string server_identifier
Server identifier for responses.
Definition http_server_options.hpp:102
std::string cors_allowed_origins
Allowed origins for CORS (empty = all).
Definition http_server_options.hpp:97
std::string private_key_file
Path to SSL private key file.
Definition http_server_options.hpp:67
std::string jwt_issuer
JWT issuer for validation.
Definition http_server_options.hpp:82