24 lines
485 B
Bash
24 lines
485 B
Bash
#!/bin/bash
|
|
|
|
file_env() {
|
|
local SECRET_NAME=$1
|
|
local SECRET_PATH="/run/secrets/$SECRET_NAME"
|
|
|
|
# Check if the secret file exists
|
|
if [[ -f "$SECRET_PATH" ]]; then
|
|
# Read the secret value
|
|
local SECRET_VALUE=$(<"$SECRET_PATH")
|
|
|
|
# Export as an environment variable
|
|
eval "export $2=\"$SECRET_VALUE\""
|
|
else
|
|
echo "Secret file not found: $SECRET_PATH"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
file_env "app_key" "APP_KEY"
|
|
file_env "db_password" "DB_PASSWORD"
|
|
|
|
/app/docker-entrypoint.sh
|