Config.sh now also udpates the mkdocs site.

This commit is contained in:
admin 2025-05-20 10:34:10 -06:00
parent 2434a1ec58
commit 4a6d0f73f1

View File

@ -23,6 +23,7 @@ ENV_FILE="$SCRIPT_DIR/.env"
SERVICES_YAML="$SCRIPT_DIR/configs/homepage/services.yaml"
WIDGETS_YAML="$SCRIPT_DIR/configs/homepage/widgets.yaml"
MKDOCS_MAIN_HTML="$SCRIPT_DIR/mkdocs/docs/overrides/main.html"
MKDOCS_YML="$SCRIPT_DIR/mkdocs/mkdocs.yml"
echo "Looking for .env file at: $ENV_FILE"
@ -405,6 +406,35 @@ update_widgets_yaml() {
return 0
}
# Function to update the site_url in mkdocs.yml
update_mkdocs_yml() {
local new_domain=$1
if [ ! -f "$MKDOCS_YML" ]; then
echo "Warning: mkdocs.yml not found at $MKDOCS_YML"
return 1
fi
echo "Updating site_url in mkdocs.yml..."
# Create a backup of the mkdocs.yml file
local timestamp=$(date +"%Y%m%d_%H%M%S")
local backup_file="${MKDOCS_YML}.backup_${timestamp}"
cp "$MKDOCS_YML" "$backup_file"
echo "Created backup of mkdocs.yml at $backup_file"
# Update the site_url value
sed -i "s|^site_url:.*|site_url: https://$new_domain|" "$MKDOCS_YML"
if grep -q "site_url: https://$new_domain" "$MKDOCS_YML"; then
echo "Updated site_url in mkdocs.yml to: https://$new_domain"
return 0
else
echo "Warning: Failed to update site_url in mkdocs.yml"
return 1
fi
}
# Make sure the initialize_env_file function is available
initialize_env_file
@ -440,7 +470,7 @@ update_env_var "EXCALIDRAW_PUBLIC_SOCKET_URL" "https://excalidraw.$domain_name"
# Update OpenWebUI settings
echo -e "\nConfiguring OpenWebUI..."
update_env_var "OPEN_WEBUI_PORT" "3005"
update_env_var "OPEN_WEBUI_URL" "https://open-webui.$domain_name"
update_env_var "OPEN_WEBUI_URL" "https://open-web-ui.$domain_name"
# Update service URLs in the services.yaml file
echo -e "\nUpdating service URLs in services.yaml file..."
@ -454,6 +484,10 @@ update_widgets_yaml "$domain_name"
echo -e "\nUpdating login button URL in MkDocs main.html..."
update_mkdocs_main_html "$domain_name"
# Update the site_url in mkdocs.yml
echo -e "\nUpdating site_url in mkdocs.yml..."
update_mkdocs_yml "$domain_name"
echo -e "Domain settings have been updated successfully!\n"
# Listmonk Admin Credentials configuration