server.config

Config reading system.

Ctor AppConfig(string) create a config from file.

Members

Aliases

LoadedConfig
alias LoadedConfig = Tuple!(immutable AppConfig, "config", string, "path")

Return value from tryConfigPaths. Handles loaded config and exact file path.

Classes

InvalidConfig
class InvalidConfig

The exception is thrown when configuration parsing error occurs (AppConfig constructor). Also encapsulates config file name.

NoConfigLoaded
class NoConfigLoaded

The exception is thrown by tryConfigPaths is called and all config file alternatives are failed to be loaded.

Functions

defaultConfig
AppConfig defaultConfig()

Returns config example to be edited by end user.

genConfig
void genConfig(string path)

Generates and write down minimal configuration to path.

tryConfigPaths
LoadedConfig tryConfigPaths(R paths)

Takes range of paths and one at a time tries to load config from each one. If the path doesn't exist, then the next candidate is checked. If the file exists, but parsing or deserializing are failed, InvalidConfig exception is thrown.

writeConfig
bool writeConfig(AppConfig appConfig, string name)

Writes configuration appConfig to file path name. It is a wrapper function around writeJson.

writeJson
bool writeJson(Json json, string name)

Writes down json to provided file name.

Structs

AppConfig
struct AppConfig

Represent configuration file.

SqlConfig
struct SqlConfig

Describes basic sql info in AppConfig

Variables

configExample
string configExample;
Undocumented in source.

Meta

License

Subject to the terms of the MIT license, as written in the included LICENSE file.

Authors

Zaramzan <shamyan.roman@gmail.com>