From b45a616d2960512b0f3e4da6ac4cb4cdbefefadd Mon Sep 17 00:00:00 2001 From: Mike Bierlee Date: Thu, 29 Sep 2022 02:10:45 +0300 Subject: [PATCH] Fix and extend valueSubstitution Example --- examples/valueSubstitution/app.d | 5 +++-- examples/valueSubstitution/config.json | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/valueSubstitution/app.d b/examples/valueSubstitution/app.d index 81521e7..82b6f89 100644 --- a/examples/valueSubstitution/app.d +++ b/examples/valueSubstitution/app.d @@ -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!" } diff --git a/examples/valueSubstitution/config.json b/examples/valueSubstitution/config.json index e570a9f..8fe7f60 100644 --- a/examples/valueSubstitution/config.json +++ b/examples/valueSubstitution/config.json @@ -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!}" }