mirror of
https://github.com/Tencent/WeKnora.git
synced 2026-06-04 13:30:32 +08:00
Two unrelated startup-noise fixes bundled because they share one file (internal/runtime/startup.go) and one motivation (make the boot log useful again). Gin per-route spam ------------------ With ~150 registered routes, DebugMode prints one "[GIN-debug] METHOD path --> handler" line per route, drowning out everything else. Override gin.DebugPrintRouteFunc to a counter and gin.DebugPrintFunc to route through the structured logger. A single "[gin] registered N routes" summary prints once router build is complete. DebugMode behaviour otherwise (panic recovery, runtime warnings) is preserved. Env config banner ----------------- Operators had no easy way to confirm SYSTEM_AES_KEY (or any other critical env) was actually loaded — getting the byte length wrong is particularly silent: utils.GetAESKey() returns nil for anything other than exactly 32 bytes, which simply disables encryption. LogStartupEnv prints one line per curated env var (security + DB + storage + redis), with sensitive values redacted as "set (N chars)" and unset values as "<unset>". Followed by targeted footgun warnings — the AES-256 length check fires loudly when SYSTEM_AES_KEY is set but wrong-length. Both helpers are called from cmd/server and cmd/desktop. The env banner runs before container.BuildContainer so it prints even if DB / storage init fails.