Skip to content

Commit

Permalink
Update docker-entrypoint.sh - Load ENVs from file
Browse files Browse the repository at this point in the history
This commit allows the end user to upload a .env file from the "Interactive Terminal" tab under the Volume Browser section. 

The user would then use the upload button to upload their .env file.

Finally, the user would go to global component control and restart the app to have it pickup the file.

WORDPRESS_DB_HOST=operator:3307
WORDPRESS_DB_USER=root
WORDPRESS_DB_PASSWORD=secret
WORDPRESS_DB_NAME=test_db
#PUBLIC_KEY=
  • Loading branch information
flikites authored Nov 22, 2024
1 parent 00d03de commit cd1fae8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
#!/usr/bin/env bash
# Load the .env file
if [ -f "${DOTENV_PATH:-/var/www/html/.env}" ]; then
# Export environment variables from the .env file
while IFS='=' read -r key value; do
# Skip comments and empty lines
if [[ ! "$key" =~ ^# && -n "$key" ]]; then
export "$key=$value"
fi
done < "${DOTENV_PATH:-/var/www/html/.env}"
else
echo ".env file not found"
fi

set -Eeuo pipefail

sourceTarArgs=(
Expand Down Expand Up @@ -103,4 +116,4 @@ fi
exec "$@"

## echo "127.0.0.1 $(hostname) localhost localhost.localdomain" >> /etc/hosts;
## service sendmail restart
## service sendmail restart

0 comments on commit cd1fae8

Please sign in to comment.