fix(t233): add redacted ERP diagnostics

This commit is contained in:
QiuSW
2026-07-29 11:24:04 +08:00
parent 817a968233
commit 1e703ef257
14 changed files with 412 additions and 28 deletions
+27 -5
View File
@@ -2,6 +2,7 @@
setlocal EnableExtensions DisableDelayedExpansion
set "PROJECT_ROOT=%~dp0"
set "SCRIPT_NAME=%~nx0"
set "BACKEND_ROOT=%PROJECT_ROOT%backend-api"
set "LOCAL_TLS_DIR=%PROJECT_ROOT%.local\cmroubao-tls"
set "LOCAL_TLS_CERT=%LOCAL_TLS_DIR%\server.crt"
@@ -21,11 +22,32 @@ if not defined CMROUBAO_TLS_CERT_FILE (
)
)
if not "%~1"=="" if /i not "%~1"=="--migrate" (
echo Usage: %~nx0 [--migrate]
echo --migrate Apply pending database migrations before starting the API.
exit /b 2
set "RUN_MIGRATIONS=0"
set "ERP_DEBUG_LOG=0"
:parse_arguments
if "%~1"=="" goto :arguments_parsed
if /i "%~1"=="--migrate" (
if "%RUN_MIGRATIONS%"=="1" goto :usage
set "RUN_MIGRATIONS=1"
shift
goto :parse_arguments
)
if /i "%~1"=="--erp-debug" (
if "%ERP_DEBUG_LOG%"=="1" goto :usage
set "ERP_DEBUG_LOG=1"
shift
goto :parse_arguments
)
goto :usage
:usage
echo Usage: %SCRIPT_NAME% [--migrate] [--erp-debug]
echo --migrate Apply pending database migrations before starting the API.
echo --erp-debug Print redacted ERP request and response diagnostics for this process.
exit /b 2
:arguments_parsed
if "%ERP_DEBUG_LOG%"=="1" set "CMROUBAO_ERP_DEBUG_LOG=true"
if not exist "%BACKEND_ROOT%\go.mod" (
echo Missing backend project: "%BACKEND_ROOT%"
@@ -63,7 +85,7 @@ if errorlevel 1 goto :startup_failed
if not exist "var\assets" mkdir "var\assets"
if errorlevel 1 goto :startup_failed
if /i "%~1"=="--migrate" (
if "%RUN_MIGRATIONS%"=="1" (
echo Applying database migrations...
go run ./cmd/migrate up
if errorlevel 1 goto :startup_failed