Orbit Framework 2.0.0
A high-performance asynchronous C++20 HTTP server framework.
Loading...
Searching...
No Matches
orbit::config::ServerConfig Struct Reference

#include <Config.hpp>

Public Types

enum class  ParseMode { Lenient , Strict }
 How parse() treats a flag it does not know. More...
 

Static Public Member Functions

static ServerConfig parse (int argc, char *argv[], ParseMode mode=ParseMode::Lenient)
 Reads the server's command-line flags (see –help).
 
static ServerConfig parse (int argc, char *argv[], ServerConfig base, ParseMode mode=ParseMode::Lenient)
 

Public Attributes

uint16_t port {8080}
 
std::string host {"0.0.0.0"}
 
int backlog {0}
 
size_t max_connections {0}
 
size_t worker_threads {4}
 
size_t event_loops {0}
 
bool cpu_affinity {false}
 
std::string log_level {"INFO"}
 
std::string log_format {"text"}
 
std::string static_dir {"./public"}
 
size_t max_body_size {10485760}
 
std::string ssl_cert {""}
 
std::string ssl_key {""}
 
std::vector< TlsCertificate > sni_certificates
 
std::chrono::seconds tls_reload_interval {0}
 
EventEngine engine {EventEngine::Epoll}
 
HttpVersion http_version {HttpVersion::Http1_1}
 
std::chrono::seconds header_timeout {10}
 
std::chrono::seconds keep_alive_timeout {10}
 
std::chrono::seconds idle_timeout {30}
 
std::chrono::seconds websocket_idle_timeout {0}
 
std::chrono::seconds websocket_ping_interval {0}
 
size_t max_header_bytes {8192}
 
size_t max_request_line {4096}
 
size_t max_headers {100}
 
size_t websocket_max_message_size {16 * 1024 * 1024}
 
std::chrono::seconds shutdown_timeout {30}
 

Member Enumeration Documentation

◆ ParseMode

How parse() treats a flag it does not know.

Enumerator
Lenient 

Report it on stderr and carry on: the application may handle its own flags.

Strict 

Report it and exit(1): the whole command line is Orbit's.

Member Function Documentation

◆ parse() [1/2]

static ServerConfig orbit::config::ServerConfig::parse ( int  argc,
char *  argv[],
ParseMode  mode = ParseMode::Lenient 
)
static

Reads the server's command-line flags (see –help).

A malformed value, or a known flag without one, is always fatal. An unknown flag is reported, with the closest known flag when there is one ("did you mean --host?"), and is fatal only in ParseMode::Strict.

◆ parse() [2/2]

static ServerConfig orbit::config::ServerConfig::parse ( int  argc,
char *  argv[],
ServerConfig  base,
ParseMode  mode = ParseMode::Lenient 
)
static

parse(), applying the flags on top of base (e.g. settings from a configuration file) instead of the defaults.

Member Data Documentation

◆ backlog

int orbit::config::ServerConfig::backlog {0}

◆ cpu_affinity

bool orbit::config::ServerConfig::cpu_affinity {false}

◆ engine

EventEngine orbit::config::ServerConfig::engine {EventEngine::Epoll}

◆ event_loops

size_t orbit::config::ServerConfig::event_loops {0}

◆ header_timeout

std::chrono::seconds orbit::config::ServerConfig::header_timeout {10}

◆ host

std::string orbit::config::ServerConfig::host {"0.0.0.0"}

◆ http_version

HttpVersion orbit::config::ServerConfig::http_version {HttpVersion::Http1_1}

◆ idle_timeout

std::chrono::seconds orbit::config::ServerConfig::idle_timeout {30}

◆ keep_alive_timeout

std::chrono::seconds orbit::config::ServerConfig::keep_alive_timeout {10}

◆ log_format

std::string orbit::config::ServerConfig::log_format {"text"}

◆ log_level

std::string orbit::config::ServerConfig::log_level {"INFO"}

◆ max_body_size

size_t orbit::config::ServerConfig::max_body_size {10485760}

◆ max_connections

size_t orbit::config::ServerConfig::max_connections {0}

◆ max_header_bytes

size_t orbit::config::ServerConfig::max_header_bytes {8192}

◆ max_headers

size_t orbit::config::ServerConfig::max_headers {100}

◆ max_request_line

size_t orbit::config::ServerConfig::max_request_line {4096}

◆ port

uint16_t orbit::config::ServerConfig::port {8080}

◆ shutdown_timeout

std::chrono::seconds orbit::config::ServerConfig::shutdown_timeout {30}

◆ sni_certificates

std::vector<TlsCertificate> orbit::config::ServerConfig::sni_certificates

◆ ssl_cert

std::string orbit::config::ServerConfig::ssl_cert {""}

◆ ssl_key

std::string orbit::config::ServerConfig::ssl_key {""}

◆ static_dir

std::string orbit::config::ServerConfig::static_dir {"./public"}

◆ tls_reload_interval

std::chrono::seconds orbit::config::ServerConfig::tls_reload_interval {0}

◆ websocket_idle_timeout

std::chrono::seconds orbit::config::ServerConfig::websocket_idle_timeout {0}

◆ websocket_max_message_size

size_t orbit::config::ServerConfig::websocket_max_message_size {16 * 1024 * 1024}

◆ websocket_ping_interval

std::chrono::seconds orbit::config::ServerConfig::websocket_ping_interval {0}

◆ worker_threads

size_t orbit::config::ServerConfig::worker_threads {4}

The documentation for this struct was generated from the following file: