2022-09-28 23:13:20 +02:00
|
|
|
/**
|
|
|
|
* Authors:
|
|
|
|
* Mike Bierlee, m.bierlee@lostmoment.com
|
|
|
|
* Copyright: 2022 Mike Bierlee
|
|
|
|
* License:
|
|
|
|
* This software is licensed under the terms of the MIT license.
|
|
|
|
* The full terms of the license can be found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2022-10-08 23:05:33 +02:00
|
|
|
import mirage.config : loadConfig;
|
2022-09-28 23:13:20 +02:00
|
|
|
|
|
|
|
import std.stdio : writeln;
|
|
|
|
import std.process : environment;
|
|
|
|
|
|
|
|
void main() {
|
2022-09-29 01:31:42 +02:00
|
|
|
// This example shows how values in configuration can be substituted with
|
2022-09-28 23:13:20 +02:00
|
|
|
// environment variables or other configuration paths.
|
|
|
|
|
2022-09-29 01:10:45 +02:00
|
|
|
environment["CONFIG_EXAMPLE_SUBJECT"] = "world";
|
2022-10-08 23:05:33 +02:00
|
|
|
auto config = loadConfig("config.json"); // Can be done with other formats too.
|
2022-09-28 23:13:20 +02:00
|
|
|
|
2022-09-29 01:10:45 +02:00
|
|
|
writeln(config.get("start")); // "Hello world! Enjoy your day!"
|
|
|
|
writeln(config.get("end")); // "Bye!"
|
2022-09-28 23:13:20 +02:00
|
|
|
}
|