Skip to content
Download

AppOptions

mach::AppOptions

Defines the application’s server configuration options.

Primary header:

#include <mach/AppOptions.hpp>

Convenience header:

#include <mach/mach.hpp>
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);
};
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.

Not thread-safe. Concurrent writes require external synchronization. Read-only access is safe after the application is built.

  • AppOptions is provided by the framework to AppBuilder::configureApp().
  • It is intended to be used only within the configuration callback.
  • Changes after AppBuilder::build() have no effect.
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);
});
Name Description
AppBuilder Builds and configures a Mach application.