updated app catalog with storage path option
This commit is contained in:
+29
-1
@@ -114,9 +114,10 @@ render_customer() {
|
||||
local customer_file="$1"
|
||||
local output_base="$2"
|
||||
|
||||
local customer_id domain
|
||||
local customer_id domain hdd_path
|
||||
customer_id=$(yaml_get_value "$customer_file" "customer_id")
|
||||
domain=$(yaml_get_value "$customer_file" "domain")
|
||||
hdd_path=$(yaml_get_value "$customer_file" "hdd_path")
|
||||
|
||||
if [[ -z "$customer_id" || -z "$domain" ]]; then
|
||||
log_error "Missing customer_id or domain in: $customer_file"
|
||||
@@ -146,6 +147,9 @@ render_customer() {
|
||||
|
||||
log_info "Apps: ${apps[*]}"
|
||||
log_info "Domain: $domain"
|
||||
if [[ -n "$hdd_path" ]]; then
|
||||
log_info "HDD path: $hdd_path"
|
||||
fi
|
||||
|
||||
# Output directory for this customer
|
||||
local customer_output="${output_base}/${customer_id}-stacks"
|
||||
@@ -154,6 +158,15 @@ render_customer() {
|
||||
echo -e " ${CYAN}[DRY-RUN]${NC} Would create: ${customer_output}/"
|
||||
for app in "${apps[@]}"; do
|
||||
echo -e " ${CYAN}[DRY-RUN]${NC} ${app}/docker-compose.yml ({{DOMAIN}} → ${domain})"
|
||||
# Check if template uses HDD_PATH
|
||||
local template="${TEMPLATES_DIR}/${app}/docker-compose.yml"
|
||||
if [[ -f "$template" ]] && grep -q '{{HDD_PATH}}' "$template"; then
|
||||
if [[ -n "$hdd_path" ]]; then
|
||||
echo -e " ${CYAN}[DRY-RUN]${NC} ↳ HDD path: {{HDD_PATH}} → ${hdd_path}"
|
||||
else
|
||||
echo -e " ${YELLOW}[DRY-RUN]${NC} ↳ ⚠ Template uses {{HDD_PATH}} but hdd_path not set!"
|
||||
fi
|
||||
fi
|
||||
# Show version override if any
|
||||
local version_override
|
||||
version_override=$(yaml_get_override "$customer_file" "${app}_version")
|
||||
@@ -172,6 +185,7 @@ render_customer() {
|
||||
# ${customer_id} - Application Stacks
|
||||
|
||||
**Domain:** \`${domain}\`
|
||||
**HDD Path:** \`${hdd_path:-N/A (no HDD apps)}\`
|
||||
**Generated:** $(date -u '+%Y-%m-%d %H:%M:%S UTC')
|
||||
**Source:** felhom-app-catalog (render.sh)
|
||||
|
||||
@@ -209,6 +223,20 @@ EOF
|
||||
# Substitute {{DOMAIN}} with customer domain
|
||||
sed "s/{{DOMAIN}}/${domain}/g" "$template" > "${customer_output}/${app}/docker-compose.yml"
|
||||
|
||||
# Substitute {{HDD_PATH}} if the template uses it
|
||||
if grep -q '{{HDD_PATH}}' "${customer_output}/${app}/docker-compose.yml"; then
|
||||
if [[ -z "$hdd_path" ]]; then
|
||||
log_error " ${app}: template uses {{HDD_PATH}} but hdd_path not set in customer config!"
|
||||
log_error " Add 'hdd_path: /mnt/hdd_1' (or similar) to ${customer_file}"
|
||||
rm "${customer_output}/${app}/docker-compose.yml"
|
||||
rmdir "${customer_output}/${app}" 2>/dev/null || true
|
||||
continue
|
||||
fi
|
||||
# Remove trailing slash from hdd_path if present
|
||||
local clean_hdd_path="${hdd_path%/}"
|
||||
sed -i "s|{{HDD_PATH}}|${clean_hdd_path}|g" "${customer_output}/${app}/docker-compose.yml"
|
||||
fi
|
||||
|
||||
# Apply version override if configured
|
||||
local version_override
|
||||
version_override=$(yaml_get_override "$customer_file" "${app}_version")
|
||||
|
||||
Reference in New Issue
Block a user