Use generic loadconfig in format non-specific examples

This commit is contained in:
Mike Bierlee 2022-10-09 00:05:33 +03:00
parent 05e44b1b26
commit 4c9f007be7
2 changed files with 4 additions and 4 deletions

View file

@ -9,12 +9,12 @@ module examples.manipulation.app;
* The full terms of the license can be found in the LICENSE file. * The full terms of the license can be found in the LICENSE file.
*/ */
import mirage.json : loadJsonConfig; import mirage.config : loadConfig;
import std.stdio : writeln; import std.stdio : writeln;
void main() { void main() {
auto config = loadJsonConfig("config.json"); auto config = loadConfig("config.json");
config.set("application.name", "Real HTTP Server"); config.set("application.name", "Real HTTP Server");
auto applicationName = config.get("application.name"); auto applicationName = config.get("application.name");

View file

@ -7,7 +7,7 @@
* The full terms of the license can be found in the LICENSE file. * The full terms of the license can be found in the LICENSE file.
*/ */
import mirage.json : loadJsonConfig, parseJsonConfig; import mirage.config : loadConfig;
import std.stdio : writeln; import std.stdio : writeln;
import std.process : environment; import std.process : environment;
@ -17,7 +17,7 @@ void main() {
// environment variables or other configuration paths. // environment variables or other configuration paths.
environment["CONFIG_EXAMPLE_SUBJECT"] = "world"; environment["CONFIG_EXAMPLE_SUBJECT"] = "world";
auto config = loadJsonConfig("config.json"); auto config = loadConfig("config.json"); // Can be done with other formats too.
writeln(config.get("start")); // "Hello world! Enjoy your day!" writeln(config.get("start")); // "Hello world! Enjoy your day!"
writeln(config.get("end")); // "Bye!" writeln(config.get("end")); // "Bye!"