Config fixes for the services. yaml and a couple minor things about making it more url agnostic.
This commit is contained in:
parent
2c0c943c3b
commit
fb90f2a58c
62
config.sh
62
config.sh
@ -366,26 +366,54 @@ update_services_yaml() {
|
|||||||
cp "$SERVICES_YAML" "$backup_file"
|
cp "$SERVICES_YAML" "$backup_file"
|
||||||
echo "Created backup of services.yaml at $backup_file"
|
echo "Created backup of services.yaml at $backup_file"
|
||||||
|
|
||||||
# Update all href values with the new domain
|
# Define service name to subdomain mapping
|
||||||
# Replace any existing domain patterns with the new domain
|
# This approach is URL-agnostic - it doesn't matter what the current URLs are
|
||||||
sed -i "s|href: \"https://code\.[^\"]*\"|href: \"https://code.$new_domain\"|g" "$SERVICES_YAML"
|
declare -A service_mappings=(
|
||||||
sed -i "s|href: \"https://listmonk\.[^\"]*\"|href: \"https://listmonk.$new_domain\"|g" "$SERVICES_YAML"
|
["Code Server"]="code.$new_domain"
|
||||||
sed -i "s|href: \"https://db\.[^\"]*\"|href: \"https://db.$new_domain\"|g" "$SERVICES_YAML"
|
["Listmonk"]="listmonk.$new_domain"
|
||||||
sed -i "s|href: \"https://map\.[^\"]*\"|href: \"https://map.$new_domain\"|g" "$SERVICES_YAML"
|
["NocoDB"]="db.$new_domain"
|
||||||
sed -i "s|href: \"https://docs\.[^\"]*\"|href: \"https://docs.$new_domain\"|g" "$SERVICES_YAML"
|
["Map Server"]="map.$new_domain"
|
||||||
sed -i "s|href: \"https://n8n\.[^\"]*\"|href: \"https://n8n.$new_domain\"|g" "$SERVICES_YAML"
|
["Main Site"]="$new_domain"
|
||||||
sed -i "s|href: \"https://git\.[^\"]*\"|href: \"https://git.$new_domain\"|g" "$SERVICES_YAML"
|
["MkDocs (Live)"]="docs.$new_domain"
|
||||||
sed -i "s|href: \"https://qr\.[^\"]*\"|href: \"https://qr.$new_domain\"|g" "$SERVICES_YAML"
|
["Mini QR"]="qr.$new_domain"
|
||||||
|
["n8n"]="n8n.$new_domain"
|
||||||
|
["Gitea"]="git.$new_domain"
|
||||||
|
)
|
||||||
|
|
||||||
# Update the main site href (matches pattern without subdomain)
|
# Process each service mapping
|
||||||
sed -i "s|href: \"https://[a-zA-Z0-9.-]*\.\(org\|com\|net\|edu\)\"|href: \"https://$new_domain\"|g" "$SERVICES_YAML"
|
for service_name in "${!service_mappings[@]}"; do
|
||||||
|
local target_url="https://${service_mappings[$service_name]}"
|
||||||
|
|
||||||
# Also update any remaining domain references that might exist
|
# Use awk to find and update the href for each specific service
|
||||||
sed -i "s|cmlite\.org|$new_domain|g" "$SERVICES_YAML"
|
# This finds the service by name and updates its href regardless of current URL
|
||||||
sed -i "s|changeme\.org|$new_domain|g" "$SERVICES_YAML"
|
awk -v service="$service_name" -v new_url="$target_url" '
|
||||||
sed -i "s|albertademocracytaskforce\.org|$new_domain|g" "$SERVICES_YAML"
|
BEGIN { in_service = 0 }
|
||||||
|
|
||||||
echo "✅ Updated service URLs in services.yaml to use domain: $new_domain"
|
# Check if we found the service name
|
||||||
|
/- [^:]+:/ {
|
||||||
|
if ($0 ~ ("- " service ":")) {
|
||||||
|
in_service = 1
|
||||||
|
} else {
|
||||||
|
in_service = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# If we are in the target service and find href line, update it
|
||||||
|
in_service && /href:/ {
|
||||||
|
gsub(/href: "[^"]*"/, "href: \"" new_url "\"")
|
||||||
|
}
|
||||||
|
|
||||||
|
# Print the line (modified or not)
|
||||||
|
{ print }
|
||||||
|
' "$SERVICES_YAML" > "${SERVICES_YAML}.tmp"
|
||||||
|
|
||||||
|
# Replace the original file with the updated version
|
||||||
|
mv "${SERVICES_YAML}.tmp" "$SERVICES_YAML"
|
||||||
|
|
||||||
|
echo " ✓ Updated $service_name -> $target_url"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "✅ All service URLs updated to use domain: $new_domain"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
- Content & Documentation:
|
- Content & Documentation:
|
||||||
- Main Site:
|
- Main Site:
|
||||||
icon: mdi-web
|
icon: mdi-web
|
||||||
href: "https://bnkserve.org"
|
href: "https://cmlite.org"
|
||||||
description: CM-lite campaign website
|
description: CM-lite campaign website
|
||||||
container: mkdocs-site-server-changemaker
|
container: mkdocs-site-server-changemaker
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user