同步
This commit is contained in:
27
soul-api/.air.production.toml
Normal file
27
soul-api/.air.production.toml
Normal 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
|
||||
@@ -1,4 +1,5 @@
|
||||
# Air 热重载配置:改 .go 后自动重新编译并重启
|
||||
# 默认使用 .env.development;使用 .env.production 时运行:air-pro 或 air -c .air.production.toml
|
||||
root = "."
|
||||
tmp_dir = "tmp"
|
||||
|
||||
|
||||
2
soul-api/.env.production.air
Normal file
2
soul-api/.env.production.air
Normal file
@@ -0,0 +1,2 @@
|
||||
# 供 .air.production.toml 使用,告知 Go 加载 .env.production
|
||||
ENV_FILE=.env.production
|
||||
4
soul-api/air-pro.bat
Normal file
4
soul-api/air-pro.bat
Normal file
@@ -0,0 +1,4 @@
|
||||
@echo off
|
||||
REM 使用 .env.production 运行 Air,等同于 air -c .air.production.toml
|
||||
cd /d "%~dp0"
|
||||
air -c .air.production.toml %*
|
||||
Reference in New Issue
Block a user