From 7d55599db95cf7f530e2827b34fa6d664f507816 Mon Sep 17 00:00:00 2001 From: augushong Date: Sun, 3 May 2026 21:20:39 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E5=9C=A8=E9=83=A8=E7=BD=B2=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E4=B8=AD=E9=BB=98=E8=AE=A4=E5=85=B3=E9=97=AD=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E5=92=8C=E6=95=B0=E6=8D=AE=E5=BA=93=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加 APP_DEBUG_VALUE 和 DB_DEBUG_VALUE 环境变量,并将其默认值设为 "false"。更新 awk 脚本以在生成 .env 配置文件时自动设置 APP_DEBUG 和 DEBUG 变量,确保生产部署时调试功能被禁用。 --- .gitea/workflows/build-and-deploy.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/build-and-deploy.yml b/.gitea/workflows/build-and-deploy.yml index bff4cbc..9c79c9e 100644 --- a/.gitea/workflows/build-and-deploy.yml +++ b/.gitea/workflows/build-and-deploy.yml @@ -9,6 +9,8 @@ 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: @@ -27,12 +29,14 @@ 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" ' - BEGIN { has_host = 0; has_pwd = 0 } + 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 } $0 ~ /^HOSTNAME=/ { print "HOSTNAME=" host has_host = 1 @@ -43,10 +47,22 @@ 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