lintel 0.2.0
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
lintel::ServerConfiguration Class Reference

#include <ServerConfiguration.h>

Public Member Functions

 ServerConfiguration (std::string host, int32_t port, const std::chrono::milliseconds &readTimeOut=std::chrono::milliseconds(0), const std::chrono::milliseconds &writeTimeOut=std::chrono::milliseconds(0), const std::chrono::milliseconds &idleInterval=std::chrono::milliseconds(0), std::filesystem::path certFile="", std::filesystem::path keyFile="", bool requireTls=false, std::vector< std::string > trustedProxies={})
 
const std::string & getHost () const
 
constexpr int32_t getPort () const
 
const std::chrono::milliseconds & getReadTimeOut () const
 
const std::chrono::milliseconds & getWriteTimeOut () const
 
const std::chrono::milliseconds & getIdleInterval () const
 
const std::filesystem::path & getCertFile () const
 
const std::filesystem::path & getKeyFile () const
 
constexpr bool isTlsRequired () const
 
const std::vector< std::string > & getTrustedProxies () const
 

Friends

std::ostream & operator<< (std::ostream &os, const ServerConfiguration &configuration)
 

Detailed Description

Configuration for an HTTP server (host, port, timeouts, TLS)

Constructor & Destructor Documentation

◆ ServerConfiguration()

lintel::ServerConfiguration::ServerConfiguration ( std::string  host,
int32_t  port,
const std::chrono::milliseconds &  readTimeOut = std::chrono::milliseconds(0),
const std::chrono::milliseconds &  writeTimeOut = std::chrono::milliseconds(0),
const std::chrono::milliseconds &  idleInterval = std::chrono::milliseconds(0),
std::filesystem::path  certFile = "",
std::filesystem::path  keyFile = "",
bool  requireTls = false,
std::vector< std::string >  trustedProxies = {} 
)
Parameters
hostbind address
portlisten port
readTimeOutread timeout (default 0 = no timeout)
writeTimeOutwrite timeout
idleIntervalidle connection timeout
certFileTLS certificate file path
keyFileTLS key file path
requireTlsrefuse to start if TLS is not configured
trustedProxiesIPs/CIDRs allowed to forward X-Forwarded-For

Member Function Documentation

◆ getCertFile()

const std::filesystem::path & lintel::ServerConfiguration::getCertFile ( ) const
Returns
the TLS certificate file path

◆ getHost()

const std::string & lintel::ServerConfiguration::getHost ( ) const
Returns
the bind host

◆ getIdleInterval()

const std::chrono::milliseconds & lintel::ServerConfiguration::getIdleInterval ( ) const
Returns
the idle interval

◆ getKeyFile()

const std::filesystem::path & lintel::ServerConfiguration::getKeyFile ( ) const
Returns
the TLS key file path

◆ getPort()

constexpr int32_t lintel::ServerConfiguration::getPort ( ) const
inlineconstexpr
Returns
the listen port

◆ getReadTimeOut()

const std::chrono::milliseconds & lintel::ServerConfiguration::getReadTimeOut ( ) const
Returns
the read timeout

◆ getTrustedProxies()

const std::vector< std::string > & lintel::ServerConfiguration::getTrustedProxies ( ) const
Returns
IPs/CIDRs trusted to forward X-Forwarded-For

◆ getWriteTimeOut()

const std::chrono::milliseconds & lintel::ServerConfiguration::getWriteTimeOut ( ) const
Returns
the write timeout

◆ isTlsRequired()

constexpr bool lintel::ServerConfiguration::isTlsRequired ( ) const
inlineconstexpr
Returns
true if the server must not start without TLS

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const ServerConfiguration &  configuration 
)
friend

Print configuration to stream


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