aidress/entrypoint.sh
2025-03-21 19:16:15 +08:00

20 lines
489 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set -e
# 检查.env文件是否存在
if [ -f .env ]; then
echo "找到.env文件加载环境变量..."
# 从.env文件导出所有环境变量
export $(grep -v '^#' .env | xargs)
else
echo ".env文件不存在使用默认环境变量..."
fi
# 打印重要环境变量,确认已加载(不打印敏感信息)
echo "环境变量检查:"
echo "DB_HOST: $DB_HOST"
echo "DB_NAME: $DB_NAME"
echo "ENVIRONMENT: $ENVIRONMENT"
# 执行原始的命令
exec "$@"