mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-28 17:01:16 +00:00
Refactor .env file creation in docker entrypoint
Moved .env file creation logic to execute earlier in the script for better clarity and structure. Ensures .env is generated before running subsequent commands, improving maintainability.
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
# Create .env file if it doesn't exist
|
||||
if [ ! -f .env ]; then
|
||||
echo "Creating .env file from environment variables..."
|
||||
envsubst < .env.dist > .env
|
||||
fi
|
||||
if [ "$1" != 'php' ] && [ "$1" != 'sh' ]; then
|
||||
# Install dependencies if not already installed
|
||||
if [ ! -d 'vendor/' ]; then
|
||||
@@ -7,11 +12,6 @@ if [ "$1" != 'php' ] && [ "$1" != 'sh' ]; then
|
||||
composer install --prefer-dist --no-progress --no-interaction
|
||||
fi
|
||||
|
||||
# Create .env file if it doesn't exist
|
||||
if [ ! -f .env ]; then
|
||||
echo "Creating .env file from environment variables..."
|
||||
envsubst < .env.dist > .env
|
||||
fi
|
||||
|
||||
# Check and wait for the database to be ready
|
||||
if grep -q ^DB_HOST= .env; then
|
||||
|
||||
Reference in New Issue
Block a user