From 046538772fe046d44f976b01edc37e9c642adb2a Mon Sep 17 00:00:00 2001 From: Paul Payne Date: Mon, 14 Jul 2025 17:51:15 -0700 Subject: [PATCH] Add gomplate processing for template syntax in app configuration --- bin/wild-app-config | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bin/wild-app-config b/bin/wild-app-config index 60fa2cb..8525c5d 100755 --- a/bin/wild-app-config +++ b/bin/wild-app-config @@ -134,6 +134,21 @@ if [ -f "${MANIFEST_FILE}" ]; then current_value=$(yq eval ".apps.${APP_NAME}.${key} // \"null\"" ${CONFIG_FILE}) if [ "${current_value}" = "null" ]; then + # Process value through gomplate if it contains template syntax + if [[ "${value}" == *"{{"* && "${value}" == *"}}"* ]]; then + # Build gomplate command with config context + gomplate_cmd="gomplate -c .=${CONFIG_FILE}" + + # Add secrets context if secrets.yaml exists + if [ -f "${SECRETS_FILE}" ]; then + gomplate_cmd="${gomplate_cmd} -c secrets=${SECRETS_FILE}" + fi + + # Process the value through gomplate + processed_value=$(echo "${value}" | ${gomplate_cmd}) + value="${processed_value}" + fi + if [[ "${value}" =~ ^[0-9]+$ ]] || [[ "${value}" =~ ^[0-9]+\.[0-9]+$ ]] || [ "${value}" = "true" ] || [ "${value}" = "false" ]; then # Numeric, boolean values don't need quotes yq eval ".apps.${APP_NAME}.${key} = ${value}" -i "${CONFIG_FILE}"