diff --git a/server/manifest/config/config.template b/server/manifest/config/config.template index 96ab376..50d6702 100644 --- a/server/manifest/config/config.template +++ b/server/manifest/config/config.template @@ -3,9 +3,9 @@ system: # 应用名称 appName: "hotgo" # debug开关,开启后接口出现错误时会向前端输出堆栈信息,可选:false|true,默认为true - debug: true + debug: false # gf运行模式,可选:not-set|develop|testing|staging|product。product模式下后台【开发工具】菜单自动隐藏 - mode: "develop" + mode: "product" # IP归属地解析方法,可选:cz88|whois,默认为whois ipMethod: "whois" # 是否为演示系统,可选:false|true @@ -33,7 +33,7 @@ system: # 统一默认日志配置 defaultLogger: &defaultLogger - level: "all" + level: "info" flags: 42 file: "{Y-m-d}.log" # 日志文件格式。默认为"{Y-m-d}.log" stdoutColorDisabled: false # 关闭终端的颜色打印。可选:false|true,默认false @@ -54,13 +54,13 @@ server: ErrorStack: true # 当Server捕获到异常时是否记录堆栈信息到日志中。默认为true ErrorLogEnabled: true # 是否记录异常日志信息到日志中。默认为true errorLogPattern: "error/{Y-m-d}.log" # 异常错误日志文件格式。默认为"error-{Ymd}.log" - accessLogEnabled: true # 是否记录访问日志。默认为false + accessLogEnabled: false # 是否记录访问日志。默认为false accessLogPattern: "access/{Y-m-d}.log" # 访问日志文件格式。默认为"access-{Ymd}.log" maxHeaderBytes: "100KB" # 请求头大小限制,请求头包括客户端提交的Cookie数据,默认设置为100KB clientMaxBodySize: "200MB" # 客户端提交的Body大小限制,同时也影响文件上传大小,默认设置为200MB serverAgent: "HG HTTP Server" # 服务端Agent信息。默认为"HG HTTP Server" # PProf配置 - pprofEnabled: true # 是否开启PProf性能调试特性。默认为false + pprofEnabled: false # 是否开启PProf性能调试特性。默认为false pprofPattern: "/pprof" # 开启PProf时有效,表示PProf特性的页面访问路径,对当前Server绑定的所有域名有效。 # 服务日志配置 logger: @@ -235,10 +235,10 @@ database: logger: path: "logs/database" # 日志文件路径。默认为空,表示关闭,仅输出到终端 <<: *defaultLogger - stdout: true + stdout: false default: link: "$MYSQL_DSN" - debug: true + debug: false Prefix: "hg_" maxOpen: 10 maxIdle: 5 diff --git a/tests/test_actions_workflow.py b/tests/test_actions_workflow.py index 99b458d..e8acc14 100644 --- a/tests/test_actions_workflow.py +++ b/tests/test_actions_workflow.py @@ -3,6 +3,7 @@ import unittest 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): @@ -34,6 +35,22 @@ class DeployWorkflowContractTest(unittest.TestCase): self.assertNotIn("KUBECONFIG", 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__": unittest.main()