Compare commits

...

2 Commits

Author SHA1 Message Date
Lance Pioch
3b91af3118 Use absolute .env path and remove redundant grep filter
- Use /var/www/html/.env consistently (matches line 3)
- Remove grep -ve "^#" since ^${VAR}= already excludes comment lines
2026-02-07 22:17:53 -05:00
Lance Pioch
4ece9dcf2e Strip quotes from .env values in Docker entrypoint
The previous grep+export approach passed surrounding quotes literally
into environment variables, causing nc to fail with bad address errors
when DB_HOST or DB_PORT were quoted in .env files.

Fixes #2132
2026-02-05 22:23:24 -05:00

View File

@@ -2,8 +2,13 @@
# check for .env file or symlink and generate app keys if missing
if [ -f /var/www/html/.env ]; then
echo "external vars exist."
# load specific env vars from .env used in the entrypoint and they are not already set
for VAR in "APP_KEY" "APP_INSTALLED" "DB_CONNECTION" "DB_HOST" "DB_PORT"; do if ! (printenv | grep -q ${VAR}); then export $(grep ${VAR} .env | grep -ve "^#"); fi; done
# load specific env vars from .env used in the entrypoint if they are not already set
for VAR in "APP_KEY" "APP_INSTALLED" "DB_CONNECTION" "DB_HOST" "DB_PORT"; do
if ! (printenv | grep -q "^${VAR}="); then
VAL=$(grep "^${VAR}=" /var/www/html/.env | head -1 | cut -d= -f2- | sed -e 's/^"//' -e 's/"$//' -e "s/^'//" -e "s/'$//")
if [ -n "$VAL" ]; then export "${VAR}=${VAL}"; fi
fi
done
else
echo "external vars don't exist."
# webroot .env is symlinked to this path