Skip to content

Commit

Permalink
Fix the GUI to use the new standard of APPNAME__VARNAME from the ol…
Browse files Browse the repository at this point in the history
…d `APPNAME_VARNAME`
  • Loading branch information
CLHatch committed Feb 18, 2025
1 parent c25896e commit cdcd77d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions .scripts/menu_app_select.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ menu_app_select() {
continue
fi
local APPONOFF
if [[ $(run_script 'env_get' "${APPNAME}_ENABLED") == true ]]; then
if [[ $(run_script 'env_get' "${APPNAME}__ENABLED") == true ]]; then
APPONOFF="on"
else
APPONOFF="off"
Expand All @@ -44,15 +44,15 @@ menu_app_select() {
else
info "Disabling all apps."
while IFS= read -r line; do
local APPNAME=${line%%_ENABLED=*}
run_script 'env_set' "${APPNAME}_ENABLED" false
done < <(grep --color=never -P '_ENABLED='"'"'?true'"'"'?$' "${COMPOSE_ENV}")
local APPNAME=${line%%__ENABLED=*}
run_script 'env_set' "${APPNAME}__ENABLED" false
done < <(grep --color=never -P '__ENABLED='"'"'?true'"'"'?$' "${COMPOSE_ENV}")

info "Enabling selected apps."
while IFS= read -r line; do
local APPNAME=${line^^}
run_script 'appvars_create' "${APPNAME}"
run_script 'env_set' "${APPNAME}_ENABLED" true
run_script 'env_set' "${APPNAME}__ENABLED" true
done < <(echo "${SELECTEDAPPS}")

run_script 'appvars_purge_all'
Expand Down
2 changes: 1 addition & 1 deletion .scripts/menu_app_vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ menu_app_vars() {
local APPNAME=${1-}
run_script 'appvars_create' "${APPNAME}"
local APPVARS
APPVARS=$(grep -v -P "^${APPNAME}_ENABLED=" "${COMPOSE_ENV}" | grep --color=never -P "^${APPNAME}_")
APPVARS=$(grep -v -P "^${APPNAME}__ENABLED=" "${COMPOSE_ENV}" | grep --color=never -P "^${APPNAME}__")
if [[ -z ${APPVARS} ]]; then
if [[ ${CI-} == true ]]; then
warn "${APPNAME} has no variables."
Expand Down
22 changes: 11 additions & 11 deletions .scripts/menu_value_prompt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,22 @@ menu_value_prompt() {
VALUEOPTIONS+=("Enter New " "")

case "${SET_VAR}" in
"${APPNAME}_ENABLED")
"${APPNAME}__ENABLED")
VALUEDESCRIPTION='\n\n Must be true or false.'
;;
"${APPNAME}_NETWORK_MODE")
"${APPNAME}__NETWORK_MODE")
VALUEDESCRIPTION='\n\n Network Mode is usually left blank but can also be bridge, host, none, service: <APPNAME>, or container: <APPNAME>.'
;;
"${APPNAME}_PORT_"*)
"${APPNAME}__PORT_"*)
VALUEDESCRIPTION='\n\n Must be an unused port between 0 and 65535.'
;;
"${APPNAME}_RESTART")
"${APPNAME}__RESTART")
VALUEDESCRIPTION='\n\n Restart is usually unless-stopped but can also be no, always, or on-failure.'
;;
"${APPNAME}_TAG")
"${APPNAME}__TAG")
VALUEDESCRIPTION='\n\n Tag is usually latest but can also be other values based on the image.'
;;
"${APPNAME}_VOLUME_"*)
"${APPNAME}__VOLUME_"*)
VALUEDESCRIPTION='\n\n If the directory selected does not exist we will attempt to create it.'
;;
DOCKER_GID)
Expand Down Expand Up @@ -142,15 +142,15 @@ menu_value_prompt() {
menu_value_prompt "${SET_VAR}"
else
case "${SET_VAR}" in
"${APPNAME}_ENABLED")
"${APPNAME}__ENABLED")
if [[ ${INPUT} == true ]] || [[ ${INPUT} == false ]]; then
run_script 'env_set' "${SET_VAR}" "${INPUT}"
else
whiptail --fb --clear --title "DockSTARTer" --msgbox "${INPUT} is not true or false. Please try setting ${SET_VAR} again." 0 0
menu_value_prompt "${SET_VAR}"
fi
;;
"${APPNAME}_NETWORK_MODE")
"${APPNAME}__NETWORK_MODE")
case "${INPUT}" in
"" | "bridge" | "host" | "none" | "service:"* | "container:"*)
run_script 'env_set' "${SET_VAR}" "${INPUT}"
Expand All @@ -161,15 +161,15 @@ menu_value_prompt() {
;;
esac
;;
"${APPNAME}_PORT_"*)
"${APPNAME}__PORT_"*)
if [[ ${INPUT} =~ ^[0-9]+$ ]] || [[ ${INPUT} -ge 0 ]] || [[ ${INPUT} -le 65535 ]]; then
run_script 'env_set' "${SET_VAR}" "${INPUT}"
else
whiptail --fb --clear --title "DockSTARTer" --msgbox "${INPUT} is not a valid port. Please try setting ${SET_VAR} again." 0 0
menu_value_prompt "${SET_VAR}"
fi
;;
"${APPNAME}_RESTART")
"${APPNAME}__RESTART")
case "${INPUT}" in
"no" | "always" | "on-failure" | "unless-stopped")
run_script 'env_set' "${SET_VAR}" "${INPUT}"
Expand All @@ -180,7 +180,7 @@ menu_value_prompt() {
;;
esac
;;
"${APPNAME}_VOLUME_"*)
"${APPNAME}__VOLUME_"*)
if [[ ${INPUT} == "/" ]]; then
whiptail --fb --clear --title "DockSTARTer" --msgbox "Cannot use / for ${SET_VAR}. Please select another folder." 0 0
menu_value_prompt "${SET_VAR}"
Expand Down

0 comments on commit cdcd77d

Please sign in to comment.