diff --git a/CONFIGURATION.md b/CONFIGURATION.md index dd5b7a7..e716a93 100644 --- a/CONFIGURATION.md +++ b/CONFIGURATION.md @@ -56,9 +56,11 @@ SMTP_USERNAME=your-email@gmail.com SMTP_PASSWORD=your-app-password SMTP_SECURE=true MAIL_FROM_ADDRESS=your-email@gmail.com -MAIL_FROM_NAME=Docmost +MAIL_FROM_NAME="Docmost" ``` +**Important**: Values with spaces must be quoted with double quotes. + ### S3 Storage To use Amazon S3 or compatible storage: @@ -110,6 +112,34 @@ cloudron exec --app docmost -- env | grep -E "(MAIL|STORAGE|S3)" | sort cloudron logs --app docmost ``` +### .env File Format Errors + +If you see errors like `line 1: Docmost: command not found`, your .env file has syntax errors: + +1. **Values with spaces must be quoted**: + ```bash + # Wrong: + MAIL_FROM_NAME=My Company + + # Correct: + MAIL_FROM_NAME="My Company" + ``` + +2. **No spaces around equals sign**: + ```bash + # Wrong: + MAIL_DRIVER = smtp + + # Correct: + MAIL_DRIVER=smtp + ``` + +3. **Check for invalid characters**: + ```bash + # Validate your .env file: + cloudron exec --app docmost -- cat /app/data/.env + ``` + ### Reset to Defaults To reset to Cloudron defaults, simply remove the custom .env file: diff --git a/start.sh b/start.sh index 17f3ed6..2740983 100644 --- a/start.sh +++ b/start.sh @@ -102,9 +102,19 @@ fi # Load custom environment variables if they exist if [ -f "/app/data/.env" ]; then echo "=> Loading custom environment variables from /app/data/.env" - set -a # automatically export all variables - source /app/data/.env - set +a # stop automatically exporting + # Validate .env file format before sourcing + if grep -q "^[[:space:]]*[^#][^=]*=" /app/data/.env 2>/dev/null; then + set -a # automatically export all variables + if source /app/data/.env 2>/dev/null; then + echo "=> Custom .env file loaded successfully" + else + echo "=> Warning: Error loading .env file, using Cloudron defaults" + echo "=> Check /app/data/.env for syntax errors (values with spaces need quotes)" + fi + set +a # stop automatically exporting + else + echo "=> Warning: /app/data/.env appears to be empty or invalid, using Cloudron defaults" + fi else echo "=> No custom .env file found, using Cloudron defaults" fi