scense/conf/config.json
ymq 7b7322dbfe fix(config): 恢复 i18n 链路 + session 时长 + 清 app/__init__.py
独立审查实测发现三个回归(均由 702f274 入口回归引起):

1【阻断】/i18n_getmsgs 500
   702f274 把 startswiths 的 i18n 条目换成了 /healthz,而 bricks 前端
   默认请求 /i18n_getmsgs(i18n.js:19)→ 500,界面文案/语言切换全受影响。
   实测 further:ahserver.globalEnv.i18n() 取 params_kw.lang,而前端传
   language → startswiths 映射本身就不可能工作。
   修复:wwwroot 放标准资源 i18n_getmsgs.dspy(按 language 读
   wwwroot/i18n/<lang>/i18n.json),startswiths 只保留 /healthz。

2【重要】会话时长回落到框架默认 120 秒
   702f274 把 config 写成 ahserver 不认识的 website.session{timeout,...},
   而 ahserver/auth_api.py 读的是 website.session_max_time(默认 120)。
   实测:登录后空闲 135s 再请求 → 401。原配置 28800s。
   修复:补回 session_max_time=28800、session_reissue_time=7200。

3【重要】app/__init__.py 仍 import 5 个已归档中间件
   每次启动 5 条 warning,且 __all__ 宣称导出的符号实测 ImportError。
   修复:清空为纯包标记;顺带移除死配置 http_semantics(新入口无
   ahapp_built 钩子,该块不会被读,且本身是已删中间件的开关)。

实测(重启后):
  /i18n_getmsgs?language=zh 200 | /healthz 200 | /index.ui 200 | login.ui 200
  空口令登录被拒(业务错误信封)| admin123 登录 200 + cookie
  带 cookie 访问受保护端点 200 | 匿名 401
2026-10-28 17:06:25 +08:00

144 lines
3.8 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"app": "yuanjing",
"app_cn": "唤景平台(世界模式)",
"port": 9380,
"host": "0.0.0.0",
"port_source": "../../../tmp/r19b_env/test.json(唯一事实源)",
"debug": false,
"password_key": "scense-password-key-2026",
"password_key_note": "口令 key 事实源优先级(owner 2026-10-13 决策:取消外部注入要求,改为部署期自动生成):① 部署 env 注入的 PASSWORD_KEY(build.sh 部署期自动生成并写 <APP_DIR>/.env);② 部署本地 key 文件 <APP_DIR>/run/password_key(0600,build.sh 部署期以 secrets.token_hex(16) 生成);③ 应用启动期若两者皆无,则自动生成并持久化该文件(打印显式 WARNING)。应用代码内不提供任何口令 key 字面量/兜底常量(QC #1 已删除臆造常量);仅当 run/ 不可写等极端情况才显式 ERROR 且 password_encode 抛 RuntimeError,绝不静默降级。",
"logger": {
"name": "yuanjing",
"level": "INFO",
"file": "$[workdir]$/logs/yuanjing.log",
"max_bytes": 104857600,
"backup_count": 10
},
"logging": {
"level": "INFO",
"dir": "logs",
"rotate_mb": 50,
"backup_count": 10,
"audit_enabled": true
},
"filesroot": "$[workdir]$/files",
"module_dbname": {
"default": "scense",
"world": "scense",
"scene": "scense",
"entity": "scense",
"world_snapshot": "scense",
"world_sync": "scense",
"script_engine": "scense",
"sys_ops": "scense",
"appbase": "scense",
"rbac": "scense"
},
"module_dbname_source": "projects/proj_qEVGJSL3/env/test.json db.dbname=scense(单库应用:全部模块解析到同一主库)",
"databases": {
"scense": {
"driver": "mysql",
"kwargs": {
"host": "localhost",
"port": 3306,
"user": "test",
"password": "cFnotAJ4g4dLreAWE31loQ==",
"db": "scense",
"charset": "utf8mb4"
}
}
},
"db": {
"engine": "mariadb",
"host": "localhost",
"port": 3306,
"user": "test",
"password": "cFnotAJ4g4dLreAWE31loQ==",
"dbname": "scense",
"charset": "utf8mb4",
"collation": "utf8mb4_general_ci",
"tcp_only": true,
"pool": {
"min": 2,
"max": 16,
"idle_timeout": 600
}
},
"credentials_note": "本文件随应用仓库提交,只放结构性配置;主机/端口/用户/口令等运行时机密一律以 $[env:XXX]$ 占位,由 build.sh 在部署机依据 projects/proj_qEVGJSL3/env/{env}.json 注入(project-directory-spec §8.1/§8.5:应用仓库禁放部署凭据、禁止编造连接参数)。",
"website": {
"port": 9380,
"root": "wwwroot",
"paths": [
[
"$[workdir]$/wwwroot",
""
]
],
"indexes": [
"index.ui",
"index.tmpl",
"index.html",
"index.dspy"
],
"processors": [
[
".tmpl",
"tmpl"
],
[
".ui",
"bui"
],
[
".dspy",
"dspy"
]
],
"static": [
".html",
".js",
".css",
".png",
".jpg",
".jpeg",
".gif",
".svg",
".ico",
".woff",
".woff2",
".ttf",
".map"
],
"session": {
"enabled": true,
"timeout": 7200,
"cookie_name": "yuanjing_sid"
},
"upload": {
"max_size": 104857600,
"allow_ext": [
".png",
".jpg",
".jpeg",
".gif",
".mp4",
".mp3",
".wav",
".json",
".zip",
".glb",
".gltf"
]
},
"startswiths": [
{
"leading": "/healthz",
"registerfunction": "healthz"
}
],
"session_max_time": 28800,
"session_reissue_time": 7200
},
"db_password_encoding": "aes-b64(appPublic.aes, key=password_key)",
"db_password_source": "env/{env}.json db.password(运行时编码,明文不落盘)"
}