Skip to content

wrap .env values in quotes #156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64

## Versions

* **16.01.23:** - Wrap `.env` values in quotes.
* **05.01.23:** - Fix db password setting (sed escape `&`).
* **21.12.22:** - Update db info in .env file when env vars are updated.
* **10.10.22:** - Remove password escape logic which caused problems for a small subset of users.
Expand Down
1 change: 1 addition & 0 deletions readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ app_setup_block: |

# changelog
changelogs:
- { date: "16.01.23:", desc: "Wrap `.env` values in quotes." }
- { date: "05.01.23:", desc: "Fix db password setting (sed escape `&`)." }
- { date: "21.12.22:", desc: "Update db info in .env file when env vars are updated." }
- { date: "10.10.22:", desc: "Remove password escape logic which caused problems for a small subset of users." }
Expand Down
14 changes: 7 additions & 7 deletions root/etc/cont-init.d/50-config
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ if [[ -n "${DB_HOST}" ]]; then

if ! grep -xqE "^[#]?DB_PORT=.*" /config/www/.env; then
# add DB_PORT line to /config/www/.env because current /app/www/.env.example doesn't have it
sed -i -E "/^[#]?DB_HOST=.*/a DB_PORT=${DB_PORT}" /config/www/.env
echo "**** Insert DB_PORT=${DB_PORT} into /config/www/.env ****"
sed -i -E "/^[#]?DB_HOST=.*/a DB_PORT='${DB_PORT}'" /config/www/.env
echo "**** Insert DB_PORT='${DB_PORT}' into /config/www/.env ****"
fi

sed -i -E "s/^[#]?DB_HOST=.*/DB_HOST=${DB_HOST}/g" /config/www/.env
sed -i -E "s/^[#]?DB_PORT=.*/DB_PORT=${DB_PORT}/g" /config/www/.env
sed -i -E "s/^[#]?DB_DATABASE=.*/DB_DATABASE=${DB_DATABASE}/g" /config/www/.env
sed -i -E "s/^[#]?DB_USERNAME=.*/DB_USERNAME=${DB_USER}/g" /config/www/.env
sed -i -E "s/^[#]?DB_PASSWORD=.*/DB_PASSWORD=${DB_PASS//&/\\&}/g" /config/www/.env
sed -i -E "s/^[#]?DB_HOST=.*/DB_HOST='${DB_HOST}'/g" /config/www/.env
sed -i -E "s/^[#]?DB_PORT=.*/DB_PORT='${DB_PORT}'/g" /config/www/.env
sed -i -E "s/^[#]?DB_DATABASE=.*/DB_DATABASE='${DB_DATABASE}'/g" /config/www/.env
sed -i -E "s/^[#]?DB_USERNAME=.*/DB_USERNAME='${DB_USER}'/g" /config/www/.env
sed -i -E "s/^[#]?DB_PASSWORD=.*/DB_PASSWORD='${DB_PASS//&/\\&}'/g" /config/www/.env
fi

# set appurl
Expand Down