29 lines
No EOL
593 B
Bash
Executable file
29 lines
No EOL
593 B
Bash
Executable file
#!/bin/sh
|
|
|
|
# Environment variable to set the API URL (if not provided, use a default)
|
|
API_URL="${API_URL:-http://localhost:3000/api}"
|
|
|
|
# Log the provided API_URL
|
|
echo "Using API URL: $API_URL"
|
|
|
|
# Check directory ownership and permissions (update as needed)
|
|
if [ ! -w /www ]; then
|
|
echo "The /www directory is not writable."
|
|
exit 1
|
|
fi
|
|
|
|
# Attempt to create or update the config.json file
|
|
if ! cat > /www/config.json <<EOF
|
|
{
|
|
"apiUrl": "$API_URL"
|
|
}
|
|
EOF
|
|
then
|
|
echo "Failed to write to config.json"
|
|
exit 1
|
|
fi
|
|
|
|
echo "config.json updated successfully."
|
|
|
|
# Run the CMD (nginx) command
|
|
exec "$@" |