mirror of
https://github.com/zyycn/codex-proxy-rs.git
synced 2026-11-06 16:06:08 +00:00
Renew active administrator sessions with atomic Redis expiry updates, synchronized cookies, and idle and absolute lifetime limits. Preserve revocation after logout and password changes. Coordinate session recovery, bounded retries, error handling, and raw responses through request plugins. Gate initial navigation in the router and organize frontend API modules by their views. Co-authored-by: Codex <noreply@openai.com>
109 lines
3.7 KiB
YAML
109 lines
3.7 KiB
YAML
# Codex Proxy RS 应用配置模板。
|
|
#
|
|
# 使用:
|
|
# sudo install -m 0640 -o "$(id -u)" -g 10001 deploy/config.example.yaml deploy/config.yaml
|
|
#
|
|
# PostgreSQL 与 Redis 密码分别执行 `openssl rand -hex 24` 生成;管理员初始密码单独设置。
|
|
|
|
schema_version: 1
|
|
|
|
host:
|
|
# 统一展示、查询日期、限额重置和定时任务的 IANA 时区,修改后重启生效。
|
|
timezone: 'Asia/Shanghai'
|
|
listen:
|
|
# 本地 cargo run 使用;Docker 内由 CPR_SERVER_HOST/PORT 覆盖。
|
|
host: '127.0.0.1'
|
|
port: 8080
|
|
# OpenAI 会话身份、系统更新状态和备份暂存区的统一根目录。
|
|
# 相对路径以 deploy/config.yaml 所在目录为基准。
|
|
runtime_data_dir: '../.runtime/data'
|
|
logging:
|
|
level: 'info'
|
|
stdout: true
|
|
# 将原始 AT/RT 写入独立 OAuth 恢复文件,沿用 file 的目录、大小与保留期。
|
|
oauth_recovery: false
|
|
# 将完整请求与响应头、正文写入独立文件;包含凭据,仅排障时开启。
|
|
request_dump: false
|
|
request_dump_retention_days: 1
|
|
file:
|
|
enabled: true
|
|
# 相对路径以 deploy/config.yaml 所在目录为基准。
|
|
directory: '../.runtime/logs'
|
|
retention_days: 7
|
|
max_file_size_mb: 20
|
|
# 二进制部署需要管理端自重启时,取消以下注释;可选路径改为实际程序绝对路径。
|
|
# Compose 已通过环境变量开启,保持本段注释即可;详情见 deploy/README.md。
|
|
# system_update:
|
|
# deployment_mode: 'binary'
|
|
# self_restart_enabled: true
|
|
# executable_path: '/opt/codex-proxy-rs/codex-proxy-rs' # 可选:覆盖启动时解析的程序路径。
|
|
drain_timeout_seconds: 30
|
|
worker_shutdown_timeout_seconds: 30
|
|
|
|
store:
|
|
database:
|
|
# Docker 内由 CPR_DATABASE_URL 覆盖;密码不要写进 URL。
|
|
url: 'postgres://codex_proxy@127.0.0.1:5432/codex_proxy'
|
|
password: &postgres_password ''
|
|
redis:
|
|
# Docker 内由 CPR_REDIS_URL 覆盖;密码不要写进 URL。
|
|
# ACL 用户写在 URL 中,例如 redis://u1@redis-host:6379/0;配置步骤见 deploy/README.md。
|
|
url: 'redis://127.0.0.1:6379/'
|
|
password: &redis_password ''
|
|
# 可选:PostgreSQL 连接池预算;下列值与当前推荐默认一致。
|
|
# pool:
|
|
# max_connections: 20
|
|
# acquire_timeout_seconds: 5
|
|
|
|
admin:
|
|
# 不活动期限与从登录起计算的最长有效期,单位为分钟
|
|
session_ttl_minutes: 10080
|
|
session_absolute_ttl_minutes: 43200
|
|
default_username: 'admin@cpr.local'
|
|
# 仅首次创建管理员时使用;至少 12 个字符且不能包含 `$`。
|
|
default_password: ''
|
|
|
|
client:
|
|
# 统一登录中密钥身份的固定会话有效期。
|
|
session_ttl_minutes: 1440
|
|
|
|
api:
|
|
# Docker 内由 CPR_WEB_DIST_DIR 覆盖。
|
|
asset_directory: '../frontend/dist'
|
|
cors_allowed_origins: []
|
|
request_timeout_seconds: null
|
|
request_id_header: 'x-request-id'
|
|
|
|
openai:
|
|
# 数据驻留约束;省略或 null 不指定地域约束,与管理端客户端身份无关。
|
|
residency: us
|
|
|
|
# Compose 启动桥接区;密码仍只维护在 store 中。
|
|
services:
|
|
app-runtime:
|
|
environment:
|
|
# 默认空值;小内存机器可改为下列值,更积极回收空闲内存,但可能增加 CPU 开销。
|
|
# 'glibc.malloc.mmap_threshold=131072:glibc.malloc.trim_threshold=131072'
|
|
# 由 Compose 在进程启动前传入,修改后需重建应用容器,详见 deploy/README.md#小内存优化。
|
|
GLIBC_TUNABLES: ''
|
|
|
|
postgres-credentials:
|
|
environment:
|
|
POSTGRES_PASSWORD: *postgres_password
|
|
|
|
redis-credentials:
|
|
command:
|
|
- redis-server
|
|
- --appendonly
|
|
- 'yes'
|
|
- --requirepass
|
|
- *redis_password
|
|
healthcheck:
|
|
test:
|
|
- CMD
|
|
- redis-cli
|
|
- --no-auth-warning
|
|
- -a
|
|
- *redis_password
|
|
- ping
|