Skip to content
Download

configureApp

mach::AppBuilder::configureApp

Configures the application.

Configures the application’s settings.

template <typename TConfigure>
requires std::invocable<TConfigure, AppOptions&>
AppBuilder& configureApp(TConfigure&& configure);

A reference to the current AppBuilder instance.

Parameter Description
TConfigure The type of the callable used to configure the application options.
Parameter Description
configure A callable that receives the application options to configure.
  • The configuration callable is invoked immediately and receives the application’s AppOptions by reference.
  • Changes made after App::run() has been called do not take effect.

This method is not thread-safe and should only be called during application configuration, before the application starts handling requests.

builder.configureApp([](mach::AppOptions& options) {
options.host = "0.0.0.0";
options.port = 8080;
options.threadCount = 8;
});
Name Description
AppOptions Defines the application’s server configuration options.
build Builds the application.