diff options
| author | Patrick Spek <p.spek@tyil.nl> | 2024-10-06 16:22:46 +0200 |
|---|---|---|
| committer | Patrick Spek <p.spek@tyil.nl> | 2024-10-06 16:22:46 +0200 |
| commit | 8c077b23dc0d7bb96096a9943fce50527882fbd6 (patch) | |
| tree | 91dacf07f47866b7a1a156d9fc51aa08347e52a2 | |
| parent | 71d1f7f2ff3caa4f910cb7a24475863fa5668587 (diff) | |
| download | bashtard-8c077b23dc0d7bb96096a9943fce50527882fbd6.tar.gz bashtard-8c077b23dc0d7bb96096a9943fce50527882fbd6.tar.bz2 | |
Hide errors of empty pkg. or svc. variables
| -rw-r--r-- | CHANGELOG.md | 4 | ||||
| -rw-r--r-- | lib/util/config.bash | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 88bbfa8..edea419 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 write the variable to the PGP encrypted host variable file (`hosts.d/$host.pgp`), again using `sq`. The key to use for encryption can be configured with `bashtard.secrets.key.id`. +- The error thrown when a variable wasn't defined is now removed if the variable + started with either `pkg.` or `svc.`. This is intended to make it unnecessary + to define a default for these variables, but still allowing it to be + overridden with `os.d` entries. ### Fixed diff --git a/lib/util/config.bash b/lib/util/config.bash index fddc82c..5dff25c 100644 --- a/lib/util/config.bash +++ b/lib/util/config.bash @@ -100,8 +100,13 @@ config_for() { return fi - # Error - alert "bashtard/config_for" "No configuration value for $key" + # Not all cases need to throw an explicit error + case "$key" in + pkg.*) return ;; + svc.*) return ;; + # Error + *) alert "bashtard/config_for" "No configuration value for $key" + esac } config_subkeys_for() { |
