fix: use production logging profile
Deploy im-manager production / deploy (push) Successful in 4m33s

This commit is contained in:
Your Name
2026-10-19 01:58:31 +08:00
parent 0553424ef9
commit ba837f4cae
2 changed files with 24 additions and 7 deletions
+7 -7
View File
@@ -3,9 +3,9 @@ system:
# 应用名称 # 应用名称
appName: "hotgo" appName: "hotgo"
# debug开关,开启后接口出现错误时会向前端输出堆栈信息,可选:false|true,默认为true # debug开关,开启后接口出现错误时会向前端输出堆栈信息,可选:false|true,默认为true
debug: true debug: false
# gf运行模式,可选:not-set|develop|testing|staging|product。product模式下后台【开发工具】菜单自动隐藏 # gf运行模式,可选:not-set|develop|testing|staging|product。product模式下后台【开发工具】菜单自动隐藏
mode: "develop" mode: "product"
# IP归属地解析方法,可选:cz88|whois,默认为whois # IP归属地解析方法,可选:cz88|whois,默认为whois
ipMethod: "whois" ipMethod: "whois"
# 是否为演示系统,可选:false|true # 是否为演示系统,可选:false|true
@@ -33,7 +33,7 @@ system:
# 统一默认日志配置 # 统一默认日志配置
defaultLogger: &defaultLogger defaultLogger: &defaultLogger
level: "all" level: "info"
flags: 42 flags: 42
file: "{Y-m-d}.log" # 日志文件格式。默认为"{Y-m-d}.log" file: "{Y-m-d}.log" # 日志文件格式。默认为"{Y-m-d}.log"
stdoutColorDisabled: false # 关闭终端的颜色打印。可选:false|true,默认false stdoutColorDisabled: false # 关闭终端的颜色打印。可选:false|true,默认false
@@ -54,13 +54,13 @@ server:
ErrorStack: true # 当Server捕获到异常时是否记录堆栈信息到日志中。默认为true ErrorStack: true # 当Server捕获到异常时是否记录堆栈信息到日志中。默认为true
ErrorLogEnabled: true # 是否记录异常日志信息到日志中。默认为true ErrorLogEnabled: true # 是否记录异常日志信息到日志中。默认为true
errorLogPattern: "error/{Y-m-d}.log" # 异常错误日志文件格式。默认为"error-{Ymd}.log" errorLogPattern: "error/{Y-m-d}.log" # 异常错误日志文件格式。默认为"error-{Ymd}.log"
accessLogEnabled: true # 是否记录访问日志。默认为false accessLogEnabled: false # 是否记录访问日志。默认为false
accessLogPattern: "access/{Y-m-d}.log" # 访问日志文件格式。默认为"access-{Ymd}.log" accessLogPattern: "access/{Y-m-d}.log" # 访问日志文件格式。默认为"access-{Ymd}.log"
maxHeaderBytes: "100KB" # 请求头大小限制,请求头包括客户端提交的Cookie数据,默认设置为100KB maxHeaderBytes: "100KB" # 请求头大小限制,请求头包括客户端提交的Cookie数据,默认设置为100KB
clientMaxBodySize: "200MB" # 客户端提交的Body大小限制,同时也影响文件上传大小,默认设置为200MB clientMaxBodySize: "200MB" # 客户端提交的Body大小限制,同时也影响文件上传大小,默认设置为200MB
serverAgent: "HG HTTP Server" # 服务端Agent信息。默认为"HG HTTP Server" serverAgent: "HG HTTP Server" # 服务端Agent信息。默认为"HG HTTP Server"
# PProf配置 # PProf配置
pprofEnabled: true # 是否开启PProf性能调试特性。默认为false pprofEnabled: false # 是否开启PProf性能调试特性。默认为false
pprofPattern: "/pprof" # 开启PProf时有效,表示PProf特性的页面访问路径,对当前Server绑定的所有域名有效。 pprofPattern: "/pprof" # 开启PProf时有效,表示PProf特性的页面访问路径,对当前Server绑定的所有域名有效。
# 服务日志配置 # 服务日志配置
logger: logger:
@@ -235,10 +235,10 @@ database:
logger: logger:
path: "logs/database" # 日志文件路径。默认为空,表示关闭,仅输出到终端 path: "logs/database" # 日志文件路径。默认为空,表示关闭,仅输出到终端
<<: *defaultLogger <<: *defaultLogger
stdout: true stdout: false
default: default:
link: "$MYSQL_DSN" link: "$MYSQL_DSN"
debug: true debug: false
Prefix: "hg_" Prefix: "hg_"
maxOpen: 10 maxOpen: 10
maxIdle: 5 maxIdle: 5
+17
View File
@@ -3,6 +3,7 @@ import unittest
WORKFLOW = Path(__file__).resolve().parents[1] / ".gitea/workflows/deploy.yml" WORKFLOW = Path(__file__).resolve().parents[1] / ".gitea/workflows/deploy.yml"
CONFIG_TEMPLATE = Path(__file__).resolve().parents[1] / "server/manifest/config/config.template"
class DeployWorkflowContractTest(unittest.TestCase): class DeployWorkflowContractTest(unittest.TestCase):
@@ -34,6 +35,22 @@ class DeployWorkflowContractTest(unittest.TestCase):
self.assertNotIn("KUBECONFIG", self.workflow) self.assertNotIn("KUBECONFIG", self.workflow)
self.assertNotIn("git.118im.com", self.workflow) self.assertNotIn("git.118im.com", self.workflow)
class ProductionConfigContractTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.config = CONFIG_TEMPLATE.read_text(encoding="utf-8")
def test_disables_debug_surfaces_and_verbose_request_logging(self):
self.assertIn(" debug: false", self.config)
self.assertNotIn("debug: true", self.config)
self.assertIn(' mode: "product"', self.config)
self.assertIn(' level: "info"', self.config)
self.assertIn(" accessLogEnabled: false", self.config)
self.assertIn(" pprofEnabled: false", self.config)
self.assertIn(" stdout: false", self.config)
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()