configureApp
mach::AppBuilder::configureApp
Configures the application.
Description
Section titled “Description”Configures the application’s settings.
Syntax
Section titled “Syntax”template <typename TConfigure> requires std::invocable<TConfigure, AppOptions&>AppBuilder& configureApp(TConfigure&& configure);Return Value
Section titled “Return Value”A reference to the current AppBuilder instance.
Template Parameters
Section titled “Template Parameters”| Parameter | Description |
|---|---|
TConfigure |
The type of the callable used to configure the application options. |
Parameters
Section titled “Parameters”| Parameter | Description |
|---|---|
configure |
A callable that receives the application options to configure. |
Remarks
Section titled “Remarks”- The configuration callable is invoked immediately and receives the application’s
AppOptionsby reference. - Changes made after App::run() has been called do not take effect.
Thread Safety
Section titled “Thread Safety”This method is not thread-safe and should only be called during application configuration, before the application starts handling requests.
Example
Section titled “Example”builder.configureApp([](mach::AppOptions& options) { options.host = "0.0.0.0"; options.port = 8080; options.threadCount = 8;});See Also
Section titled “See Also”| Name | Description |
|---|---|
AppOptions |
Defines the application’s server configuration options. |
build |
Builds the application. |