Skip to content

Commit

Permalink
Bug fix for assigning options not defined in allOptions array.
Browse files Browse the repository at this point in the history
  • Loading branch information
paultraf committed May 13, 2024
1 parent d0df045 commit c946634
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion lib/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ config_get() {
if [ -n "${3+x}" ]; then
config_home="$3/"
fi

# Just echo back an option if it's already defined before allOptions array
myvar_ref="$1"
tempvar=${!myvar_ref}
[ "$tempvar" != "" ] && { printf "%s" "$tempvar"; return; }

val="$(config_read_file "${config_home}config/$2".cfg "$1")";
if [ "$val" = "__UNDEFINED__" ]; then
val="$(config_read_file config/default.cfg "$1")";
Expand Down Expand Up @@ -102,7 +108,7 @@ assign_option_variables() {
for opt in "${options_list[@]}"; do
# standardise values for options of type yes/no
if [[ ' '${options_check_yesno[*]}' ' =~ ' '$opt' ' ]]; then
printf -v "${opt}" '%s' "$(yesno "$(config_get "$opt" "$myconfig")")"
printf -v "${opt}" '%s' "$(yesno "$(config_get "$opt" "$myconfig")")"
else
printf -v "${opt}" '%s' "$(config_get "$opt" "$myconfig")"
fi
Expand Down
2 changes: 1 addition & 1 deletion lib/constants.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
################################################
# MakeStaticSite info
################################################
version=0.29.5+2
version=0.29.6
version_date='13 May 2024'
version_header="MakeStaticSite version $version, released on $version_date."
mss_license="GNU Affero General Public License version 3"
Expand Down

0 comments on commit c946634

Please sign in to comment.