api-uni / entrypoint.sh
sunwangwang's picture
Update entrypoint.sh
1c6b7dc verified
#!/bin/sh
set -e
CONFIG_FILE_PATH="/home/api.yaml" # Note this is changed to /home/api.yaml
echo "DEBUG: Entrypoint script started."
# Check if Secret exists
if [ -z "$API_YAML_CONTENT" ]; then
echo "ERROR: Secret 'API_YAML_CONTENT' does not exist or is empty. Exiting."
exit 1
else
echo "DEBUG: API_YAML_CONTENT secret found. Preparing to write..."
printf '%s\n' "$API_YAML_CONTENT" > "$CONFIG_FILE_PATH"
echo "DEBUG: Attempted to write to $CONFIG_FILE_PATH."
if [ -f "$CONFIG_FILE_PATH" ]; then
echo "DEBUG: File $CONFIG_FILE_PATH created successfully. Size: $(wc -c < "$CONFIG_FILE_PATH") bytes."
# Display the first few lines for debugging (be careful not to display sensitive information)
echo "DEBUG: First few lines (without sensitive info):"
head -n 3 "$CONFIG_FILE_PATH" | grep -v "api:" | grep -v "password"
else
echo "ERROR: File $CONFIG_FILE_PATH was NOT created."
exit 1
fi
fi
echo "DEBUG: About to execute python main.py..."
# No need to use the --config parameter as the program has a default path
cd /home
exec python main.py "$@"