From 480a2210694540b830b03d5675cfdfb23e59c178 Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Sat, 24 Jul 2021 15:27:29 +0900 Subject: [PATCH] include/conf: Add function to get available configuration entries The conf module currently does not provide a means to figure out what configuration entries are available. This commit adds a method that allows the caller to figure out what configuration settings are available in a given configuration domain. --- include/conf.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/conf.sh b/include/conf.sh index a5de6d0..3cf7c9a 100644 --- a/include/conf.sh +++ b/include/conf.sh @@ -105,3 +105,21 @@ conf_get_domains() { return 0 } + +conf_get_names() { + local config="$1" + + local confpath + + if [[ -z "$config" ]]; then + config="default" + fi + + confpath="$__conf_root/$config.conf" + + if ! grep -oP "^\\K[^=]+" < "$confpath"; then + return 1 + fi + + return 0 +} -- 2.47.3