mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-01 15:32:48 +08:00
ci: 移除工作流中调试变量的硬编码设置
All checks were successful
build-and-deploy / 直传代码并部署到 Host15 (push) Successful in 1m29s
All checks were successful
build-and-deploy / 直传代码并部署到 Host15 (push) Successful in 1m29s
移除环境变量 APP_DEBUG_VALUE 和 DB_DEBUG_VALUE 的定义及其在 awk 脚本中的处理逻辑。 这些调试设置不应在部署工作流中硬编码,而应由环境配置文件或更灵活的机制管理。
This commit is contained in:
@@ -9,8 +9,6 @@ env:
|
||||
PACKAGE_NAME: ulthon_admin_release.tar.gz
|
||||
COMPOSE_PROJECT_NAME: ulthon_admin
|
||||
DB_HOSTNAME: host.docker.internal
|
||||
APP_DEBUG_VALUE: "false"
|
||||
DB_DEBUG_VALUE: "false"
|
||||
|
||||
jobs:
|
||||
deploy_host15:
|
||||
@@ -29,14 +27,12 @@ jobs:
|
||||
env:
|
||||
MYSQL_PASSWORD: ${{ secrets.MYSQL_PASSWORD }}
|
||||
DB_HOSTNAME: ${{ env.DB_HOSTNAME }}
|
||||
APP_DEBUG_VALUE: ${{ env.APP_DEBUG_VALUE }}
|
||||
DB_DEBUG_VALUE: ${{ env.DB_DEBUG_VALUE }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cp .example.env .env
|
||||
|
||||
awk -v host="$DB_HOSTNAME" -v newpwd="$MYSQL_PASSWORD" -v app_debug="$APP_DEBUG_VALUE" -v db_debug="$DB_DEBUG_VALUE" '
|
||||
BEGIN { has_host = 0; has_pwd = 0; has_app_debug = 0; has_db_debug = 0 }
|
||||
awk -v host="$DB_HOSTNAME" -v newpwd="$MYSQL_PASSWORD" '
|
||||
BEGIN { has_host = 0; has_pwd = 0 }
|
||||
$0 ~ /^HOSTNAME=/ {
|
||||
print "HOSTNAME=" host
|
||||
has_host = 1
|
||||
@@ -47,22 +43,10 @@ jobs:
|
||||
has_pwd = 1
|
||||
next
|
||||
}
|
||||
$0 ~ /^APP_DEBUG=/ {
|
||||
print "APP_DEBUG=" app_debug
|
||||
has_app_debug = 1
|
||||
next
|
||||
}
|
||||
$0 ~ /^DEBUG=/ {
|
||||
print "DEBUG=" db_debug
|
||||
has_db_debug = 1
|
||||
next
|
||||
}
|
||||
{ print }
|
||||
END {
|
||||
if (!has_host) print "HOSTNAME=" host
|
||||
if (!has_pwd) print "PASSWORD=" newpwd
|
||||
if (!has_app_debug) print "APP_DEBUG=" app_debug
|
||||
if (!has_db_debug) print "DEBUG=" db_debug
|
||||
}' .env > .env.tmp
|
||||
|
||||
mv .env.tmp .env
|
||||
|
||||
Reference in New Issue
Block a user