This commit is contained in:
乘风
2026-02-24 15:25:18 +08:00
parent 1860a206f9
commit 681917caac
4 changed files with 34 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
# Air 热重载配置(生产环境):使用 .env.production
# 运行方式air -c .air.production.toml 或 air-pro
root = "."
tmp_dir = "tmp"
# 加载 .env.production并设置 ENV_FILE 供 Go 使用
env_files = [".env.production", ".env.production.air"]
# Windows 下用 .exe 避免系统弹出「选择应用打开 main」
[build]
bin = "./tmp/main.exe"
cmd = "go build -o ./tmp/main.exe ./cmd/server"
delay = 800
exclude_dir = ["tmp", "vendor"]
exclude_regex = ["_test\\.go$"]
include_ext = ["go", "tpl", "tmpl", "html"]
log = "build-errors.log"
stop_on_error = true
[log]
time = false
[misc]
clean_on_exit = true
[screen]
clear_on_rebuild = false

View File

@@ -1,4 +1,5 @@
# Air 热重载配置:改 .go 后自动重新编译并重启
# 默认使用 .env.development使用 .env.production 时运行air-pro 或 air -c .air.production.toml
root = "."
tmp_dir = "tmp"

View File

@@ -0,0 +1,2 @@
# 供 .air.production.toml 使用,告知 Go 加载 .env.production
ENV_FILE=.env.production

4
soul-api/air-pro.bat Normal file
View File

@@ -0,0 +1,4 @@
@echo off
REM 使用 .env.production 运行 Air等同于 air -c .air.production.toml
cd /d "%~dp0"
air -c .air.production.toml %*