diff --git a/README.md b/README.md index 3d23c8e..a91390b 100644 --- a/README.md +++ b/README.md @@ -25,21 +25,23 @@ import std.stdio : writeln; import mirage : loadConfig, parseJavaProperties; void main() { - // Load configuration from file (see examples/quickstart/config.json): + // Load configuration from file (see examples/quickstart/config.json) auto config = loadConfig("config.json"); writeln(config.get("application.name")); writeln(config.get!long("application.version")); - // Or parse directly from string: - auto properties = parseJavaProperties(" + // Or parse directly from string + auto ini = parseIniConfig(" databaseDriver = Postgres - database.host = localhost - database.port = 5432 + + [database] + host = localhost + port = 5432 "); - auto databaseConfig = properties.getConfig("database"); + auto databaseConfig = ini.getConfig("database"); - writeln(properties.get("databaseDriver")); + writeln(ini.get("databaseDriver")); writeln(databaseConfig.get("host")); writeln(databaseConfig.get("port")); } diff --git a/examples/quickstart/app.d b/examples/quickstart/app.d index 4949d65..d2c8209 100644 --- a/examples/quickstart/app.d +++ b/examples/quickstart/app.d @@ -10,24 +10,26 @@ module examples.quickstart.app; */ import std.stdio : writeln; -import mirage : loadConfig, parseJavaProperties; +import mirage : loadConfig, parseIniConfig; void main() { - // Load configuration from file (see examples/quickstart/config.json): + // Load configuration from file (see examples/quickstart/config.json) auto config = loadConfig("config.json"); writeln(config.get("application.name")); writeln(config.get!long("application.version")); - // Or parse directly from string: - auto properties = parseJavaProperties(" + // Or parse directly from string + auto ini = parseIniConfig(" databaseDriver = Postgres - database.host = localhost - database.port = 5432 + + [database] + host = localhost + port = 5432 "); - auto databaseConfig = properties.getConfig("database"); + auto databaseConfig = ini.getConfig("database"); - writeln(properties.get("databaseDriver")); + writeln(ini.get("databaseDriver")); writeln(databaseConfig.get("host")); writeln(databaseConfig.get("port")); }