Adds memcached and openproject apps.
This commit is contained in:
@@ -134,39 +134,35 @@ fi
|
||||
# Extract defaultConfig from manifest.yaml and merge into config.yaml
|
||||
if yq eval '.defaultConfig' "${DEST_APP_DIR}/manifest.yaml" | grep -q -v '^null$'; then
|
||||
echo "Merging defaultConfig from manifest.yaml into .wildcloud/config.yaml"
|
||||
# Merge each key from defaultConfig into the app's config, only if not already set
|
||||
yq eval '.defaultConfig | keys | .[]' "${DEST_APP_DIR}/manifest.yaml" | while read -r key; do
|
||||
# Get the value from defaultConfig
|
||||
value=$(yq eval ".defaultConfig.${key}" "${DEST_APP_DIR}/manifest.yaml")
|
||||
|
||||
# Check if key exists and is not null in app config
|
||||
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}"
|
||||
else
|
||||
# String values need quotes
|
||||
yq eval ".apps.${APP_NAME}.${key} = \"${value}\"" -i "${CONFIG_FILE}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Check if the app config already exists
|
||||
if yq eval ".apps.${APP_NAME}" "${CONFIG_FILE}" | grep -q '^null$'; then
|
||||
yq eval ".apps.${APP_NAME} = {}" -i "${CONFIG_FILE}"
|
||||
fi
|
||||
|
||||
# Merge defaultConfig into the app config, preserving nested structure
|
||||
# This preserves the nested structure for objects like resources.requests.memory
|
||||
temp_manifest=$(mktemp)
|
||||
yq eval '.defaultConfig' "${DEST_APP_DIR}/manifest.yaml" > "$temp_manifest"
|
||||
yq eval ".apps.${APP_NAME} = (.apps.${APP_NAME} // {}) * load(\"$temp_manifest\")" -i "${CONFIG_FILE}"
|
||||
rm "$temp_manifest"
|
||||
|
||||
# Process template variables in the merged config
|
||||
echo "Processing template variables in app config"
|
||||
temp_config=$(mktemp)
|
||||
|
||||
# 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 entire config file through gomplate to resolve template variables
|
||||
${gomplate_cmd} -f "${CONFIG_FILE}" > "$temp_config"
|
||||
mv "$temp_config" "${CONFIG_FILE}"
|
||||
|
||||
echo "Merged defaultConfig for app '${APP_NAME}'"
|
||||
fi
|
||||
|
||||
|
@@ -47,7 +47,7 @@ fi
|
||||
|
||||
# Initialize Wild Cloud environment
|
||||
if [ -z "${WC_ROOT}" ]; then
|
||||
print "WC_ROOT is not set."
|
||||
echo "WC_ROOT is not set."
|
||||
exit 1
|
||||
else
|
||||
source "${WC_ROOT}/scripts/common.sh"
|
||||
|
@@ -51,11 +51,10 @@ done
|
||||
# Initialize Wild Cloud environment
|
||||
|
||||
if [ -z "${WC_ROOT}" ]; then
|
||||
print "WC_ROOT is not set."
|
||||
echo "WC_ROOT is not set."
|
||||
exit 1
|
||||
else
|
||||
source "${WC_ROOT}/scripts/common.sh"
|
||||
init_wild_env
|
||||
fi
|
||||
|
||||
TEMPLATE_DIR="${WC_ROOT}/setup/home-scaffold"
|
||||
|
Reference in New Issue
Block a user