feat(web): 新增 web.console_log 开关;data_dir 默认改为 srv/mesh_mqtt_go

- WebConfig 增加 console_log 字段,关闭后 gin 不再向控制台打印 HTTP 访问日志(保留 Recovery)
- 默认值 true;旧配置加载时自动补齐并写回
- defaultDataDirForGOOS 默认目录由 var/lib/mesh_mqtt_go 调整为 srv/mesh_mqtt_go,与 install.sh 中 DATA_DIR=/srv/${SERVICE_NAME} 保持一致
- install.sh 模板同步加入 console_log: true

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-06-19 15:43:38 +08:00
co-authored by Claude
parent d57dff58f3
commit 98d5e9e117
3 changed files with 16 additions and 3 deletions
+5 -1
View File
@@ -62,7 +62,11 @@ func ServeUnixSocket(server *http.Server, socketPath string) error {
func NewRouter(cfg configpkg.WebConfig, store *storepkg.Store, sessions *auth.Manager, mqttStatus MQTTStatusProvider, blocking *blockingpkg.Cache, forwarder mqttforwardpkg.Reloader, settings *rspkg.Cache, botSender botpkg.TextSender) *gin.Engine {
r := gin.New()
r.Use(gin.Logger(), gin.Recovery())
if cfg.ConsoleLog {
r.Use(gin.Logger(), gin.Recovery())
} else {
r.Use(gin.Recovery())
}
api := r.Group("/api")
registerAPIRoutes(api, store, cfg.MapTileCacheDir)
registerAdminRoutes(api.Group("/admin"), store, sessions, mqttStatus, blocking, forwarder, settings, botSender)