config.h

The config.h module represents runtime configuration options as outlined in Configuration. Refer to that document for more details on what each option means.

API

typedef struct lua_State mn_lua_t

An alias to the lua_State object provided by Lua.

enum mn_event_loop

The event loop to use. Currently the only supported value is MN_EVENT_LOOP_POLL.

unsigned int MN_EVENT_LOOP_POLL = 0
struct mn_config

Configuration options supplied to the mn_server on initialization.

unsigned long long coro_pages

A reference to the COROUTINE_PAGES option.

enum mn_event_loop ev_loop

A reference to the EVENT_LOOP option.

enum mn_log_level log_level

A reference to the LOG_LEVEL option.

unsigned long port

A reference to the PORT option.

struct mn_status mn_config_load(
struct mn_config out[static const 1]
)

Loads the default configuration.

If successful, the out parameter must be cleaned up using mn_config_unload().

Parameters:
Returns:

An mn_status with value:
- MN_ERROR_NONE on success;
- MN_ERROR_CONFIG on failure.

Aborts:

If space for MN_REQUEST_MAX_CAPTURES could not be allocated.

struct mn_status mn_config_load_with(
struct mn_str const path,
struct mn_config out[static const 1]
)

Loads the default configuration and then applies any overridden configuration options as defined in the file at path.

If successful, the out parameter must be cleaned up using mn_config_unload().

Parameters:
  • path – The location of a lua file to execute.

  • out – The mn_config reference to load.

Returns:

An mn_status with value:
- MN_ERROR_NONE on success;
- MN_ERROR_CONFIG on failure.

Aborts:

If space for MN_REQUEST_MAX_CAPTURES could not be allocated.

void mn_config_unload(struct mn_config c[static const 1])

Unloads a configuration object.

Should be called once you are finished using a mn_config object that was successfully loaded by a call to mn_config_load() or mn_config_load_with().

Parameters:
  • c – The configuration to unload.