mirror of
https://github.com/mbierlee/mirage-config.git
synced 2024-11-15 04:44:01 +01:00
Use generic loadconfig in format non-specific examples
This commit is contained in:
parent
05e44b1b26
commit
4c9f007be7
|
@ -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");
|
||||||
|
|
|
@ -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!"
|
||||||
|
|
Loading…
Reference in a new issue