Struct ServerinoConfig

Struct used to setup serverino. You must return this struct from a function with @onServerInit UDA attached.

struct ServerinoConfig ;
@onServerInit
auto configure()
{
   // You can chain methods
   ServerinoConfig config =
      ServerinoConfig.create()
      .setWorkers(5)
      .enableKeepAlive();

   return config;
}

Methods

NameDescription
addListener (address, port) Add a new listener.
create () Create a new instance of ServerinoConfig
disableKeepAlive () Enable/Disable keep-alive for http/1.1
disableLoggerOverride () Enables or disables the override of std.logger.
disableRemoteIp ()
disableServerSignature () Enable/Disable serverino signature
disableWorkersAutoReload () Automatic hot reload of workers when the main executable is modified. Be careful: daemon is not reloaded and its code (eg: config) is not updated.
enableKeepAlive (enable, timeout) Enable/Disable keep-alive for http/1.1
enableLoggerOverride (enable) Enables or disables the override of std.logger.
enableRemoteIp (enable) Add a x-remote-ip header
enableServerSignature (enable) Enable/Disable serverino signature
enableWorkersAutoReload (enable) Automatic hot reload of workers when the main executable is modified. Be careful: daemon is not reloaded and its code (eg: config) is not updated.
setHttpTimeout (dur) Sets the maximum duration the socket will wait for a request after the connection.
setListenerBacklog (val) Sets the maximum number of pending connections in the listener's backlog.
setLogLevel (level) Sets the minimum log level to display. The default is LogLevel.all.
setMaxDynamicWorkerIdling (dur) Max time a dynamic worker can be idle. After this time, worker is terminated. This is used only if the number of workers is greater than minWorkers.
setMaxRequestSize (bytes) Sets the maximum allowable size for a request. Requests exceeding this size will return a 413 error.
setMaxRequestTime (dur) Sets the maximum duration a request can take. After this time, the worker handling the request is terminated.
setMaxWorkerIdling (dur) Sets the maximum idle time for a worker. After this duration, the worker is terminated.
setMaxWorkerLifetime (dur) Sets the maximum lifetime for a worker. After this duration, the worker is terminated.
setMaxWorkers (val) Sets the maximum number of worker processes.
setMinWorkers (val) Sets the minimum number of worker processes.
setReturnCode (retCode, forceExit) Any non-zero value will cause the server to terminate immediately. If forceExit is true, the server will terminate even if retCode is 0.
setWorkerGroup (s) For example: "www-data"
setWorkers (val) Same as setMaxWorkers(v); setMinWorkers(v);
setWorkerUser (s) For example: "www-data"

Enums

NameDescription
ListenerProtocol Protocol used by listener