Skip to content

Commit

Permalink
优化启动脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerry committed Apr 25, 2024
1 parent 7f9dd18 commit 29d8596
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion components.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"typescript": true,
"tailwind": {
"config": "tailwind.config.ts",
"css": "assets/index.css",
"css": "assets/css/index.css",
"baseColor": "stone",
"cssVariables": true
},
Expand Down
13 changes: 3 additions & 10 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,27 @@ npx prisma migrate deploy

export VERSION=$(cat /app/version)


CONFIG_FILE="/app/config"

if [ -f "$CONFIG_FILE" ]; then
# 使用进程替换来过滤掉注释行
while IFS='=' read -r key value; do
if [[ -z "$key" ]]; then
continue
fi

if [[ $key == \#* ]]; then
if [[ -z "$key" ]] || [[ $key == \#* ]]; then
continue
fi

if [[ -z "$value" ]]; then
continue
fi

key=$(echo "$key" | xargs)
value=$(echo "$value" | xargs)

# 检查环境变量是否已经存在,存在则忽略
if [ -z "$(printenv "$key")" ]; then
export "$key"="$value"
echo "Set ENV: $key => Value: $value"
else
echo "环境变量 $key 已经存在,忽略"
fi
done < "$CONFIG_FILE"
done < <(cat "$CONFIG_FILE" | grep -v '^#')
else
echo "配置文件 $CONFIG_FILE 不存在,忽略读取并导出环境变量的过程"
fi
Expand Down

0 comments on commit 29d8596

Please sign in to comment.