From 1f5cc39b3cb388e69e479d8b2b1a774c2abde37d Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 7 Dec 2021 15:40:14 +0100 Subject: global-config: load overlay automatically --- README.d/06-run-and-schedule-scripts.png | Bin 5416 -> 4526 bytes README.md | 4 ++-- global-config | 8 ++++++++ global-functions | 8 ++++---- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/README.d/06-run-and-schedule-scripts.png b/README.d/06-run-and-schedule-scripts.png index bd8aa9f..23b4d7b 100644 Binary files a/README.d/06-run-and-schedule-scripts.png and b/README.d/06-run-and-schedule-scripts.png differ diff --git a/README.md b/README.md index f98cf6b..eea9014 100644 --- a/README.md +++ b/README.md @@ -99,8 +99,8 @@ Save changes and exit with `Ctrl-o`. And finally load configuration and functions and add the scheduler. - / system script { run global-config; run global-config-overlay; run global-functions; }; - / system scheduler add name="global-scripts" start-time=startup on-event="/ system script { run global-config; run global-config-overlay; run global-functions; }"; + / system script { run global-config; run global-functions; }; + / system scheduler add name="global-scripts" start-time=startup on-event="/ system script { run global-config; run global-functions; }"; ![screenshot: run and schedule scripts](README.d/06-run-and-schedule-scripts.png) diff --git a/global-config b/global-config index e03b5eb..522155e 100644 --- a/global-config +++ b/global-config @@ -193,3 +193,11 @@ "cert1-cn"="v3ry-s3cr3t"; "cert2-cn"="4n0th3r-s3cr3t"; } + +# load custom settings from overlay +# Warning: Do *NOT* copy this code to overlay! +:do { + / system script run global-config-overlay; +} on-error={ + :log error ("Loading configuration from overlay failed!"); +} diff --git a/global-functions b/global-functions index ba6419d..b313b70 100644 --- a/global-functions +++ b/global-functions @@ -777,11 +777,11 @@ } :if ($ReloadGlobalConfig = true) do={ - $LogPrintExit2 info $0 ("Reloading global configuration and overlay.") false; + $LogPrintExit2 info $0 ("Reloading global configuration.") false; :do { - / system script { run global-config; run global-config-overlay; } + / system script run global-config; } on-error={ - $LogPrintExit2 error $0 ("Reloading global configuration and overlay failed!" . \ + $LogPrintExit2 error $0 ("Reloading global configuration failed!" . \ " Syntax error or missing overlay\?") false; } } @@ -838,7 +838,7 @@ :local NotificationMessage ("Current configuration on " . $Identity . \ " is out of date. Please update global-config-overlay, then increase " . \ "\$GlobalConfigVersion (currently " . $GlobalConfigVersion . \ - ") to " . $ExpectedConfigVersion . " and re-run global-config-overlay."); + ") to " . $ExpectedConfigVersion . " and re-run global-config."); $LogPrintExit2 info $0 ($NotificationMessage) false; :if ([ :len $GlobalConfigChanges ] > 0) do={ -- cgit v1.2.3-54-g00ecf