mirror of
https://github.com/mbierlee/mirage-config.git
synced 2024-11-15 04:44:01 +01:00
Fix and extend valueSubstitution Example
This commit is contained in:
parent
df3ccf8007
commit
b45a616d29
|
@ -16,8 +16,9 @@ void main() {
|
|||
// This example shows how values in configuration can be substituted from
|
||||
// environment variables or other configuration paths.
|
||||
|
||||
environment["subject"] = "world";
|
||||
environment["CONFIG_EXAMPLE_SUBJECT"] = "world";
|
||||
auto config = loadJsonConfig("config.json");
|
||||
|
||||
writeln(config.get("greeting"));
|
||||
writeln(config.get("start")); // "Hello world! Enjoy your day!"
|
||||
writeln(config.get("end")); // "Bye!"
|
||||
}
|
||||
|
|
|
@ -4,5 +4,6 @@
|
|||
"subject": "$CONFIG_EXAMPLE_SUBJECT",
|
||||
"followUp": "${CONFIG_EXAMPLE_FOLLOW_UP:Enjoy your day!}"
|
||||
},
|
||||
"greeting": "${parameters.greeting} ${parameters.subject}! ${parameters.followUp}"
|
||||
"start": "${parameters.greeting} ${parameters.subject}! ${parameters.followUp}",
|
||||
"end": "${parameters.farewell:Bye!}"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue