AppOptions
mach::AppOptions
Description
Section titled “Description”Defines the application’s server configuration options.
Headers
Section titled “Headers”Primary header:
#include <mach/AppOptions.hpp>Convenience header:
#include <mach/mach.hpp>Syntax
Section titled “Syntax”struct AppOptions { std::string host = "127.0.0.1"; std::int32_t port = 3143; std::int64_t threadCount = 4;
std::chrono::seconds requestTimeout = std::chrono::seconds(30);};Data Members
Section titled “Data Members”| Name | Description |
|---|---|
host |
The network interface the server binds to. |
port |
The port the server listens on. |
threadCount |
The number of worker threads used to process requests. |
requestTimeout |
The read and write timeout applied to HTTP connections. |
Thread Safety
Section titled “Thread Safety”Not thread-safe. Concurrent writes require external synchronization. Read-only access is safe after the application is built.
Remarks
Section titled “Remarks”AppOptionsis provided by the framework toAppBuilder::configureApp().- It is intended to be used only within the configuration callback.
- Changes after
AppBuilder::build()have no effect.
Example
Section titled “Example”auto builder = mach::AppBuilder;
builder.configureApp([](mach::AppOptions& options){ options.host = "0.0.0.0"; options.port = 8080; options.threadCount = 16; options.requestTimeout = std::chrono::seconds(60);});See Also
Section titled “See Also”| Name | Description |
|---|---|
AppBuilder |
Builds and configures a Mach application. |