v2 配置
本页面列出了所有在 v2 服务的 config/*.json 配置文件中可用的配置选项及其说明。v1(.env)的配置项请参考配置。
警告
在生产环境中,请务必更改默认的密钥和密码!
文档贡献者提示
此页面是自动生成的,任何更改都将被覆盖。如果你想要更改翻译,请在 data/v2-configuration/zh-CN.js 中修改。配置项的定义(路径、类型、默认值)位于同目录的 data/v2-configuration/definitions/ 文件夹内,请勿在此页面中重复维护。点击左下角的 "在 GitHub 上编辑此页" 链接可以直接跳转到翻译文件的编辑页面。
general.json — 通用配置
| 配置项 | 描述 | 类型 | 默认值 |
|---|---|---|---|
UseLegacyDatabase | 是否使用 v1 MySQL(旧版)数据库。设为 false 时改用 PostgresqlConnectionString 指定的 PostgreSQL 数据库。 | boolean | true |
MySqlHost | MySQL 服务器地址 | string | 127.0.0.1 |
MySqlPort | MySQL 服务器端口 | string | 3306 |
MySqlDatabase | MySQL 数据库名称 | string | osu_api |
MySqlUsername | MySQL 用户名 | string | osu_api |
MySqlPassword | MySQL 密码 | string | password |
PostgresqlConnectionString | PostgreSQL 连接字符串(UseLegacyDatabase 为 false 时使用)。格式:Host=...;Port=...;Username=...;Password=...;Database=... | string | Host=localhost;Port=5432;Username=g0v0;Password=password;Database=g0v0 |
RedisHost | Redis 连接 URL | string | localhost:6379 |
JwtSecretKey | JWT 签名密钥 | string | your_jwt_secret_here |
JwtAlgorithm | JWT 算法 | string | HS256 |
JwtAudience | JWT 受众 | string | 5 |
JwtIssuer | JWT 签发者 | string | null |
OsuClientId | OAuth 客户端 ID | integer | 5 |
OsuClientSecret | OAuth 客户端密钥 | string | FGc9GAtyHzeQDshWP5Ah7dega8hJACAJpQtw6OXk |
OsuWebClientId | Web OAuth 客户端 ID | integer | 6 |
OsuWebClientSecret | Web OAuth 客户端密钥 | string | your_osu_web_client_secret_here |
FetcherClientId | Fetcher 客户端 ID | integer | 0 |
FetcherClientSecret | Fetcher 客户端密钥 | string | "" |
FetcherBeatmapRawCacheExpireHours | 谱面缓存过期时间(小时) | integer | 24 |
ServerUrl | 服务器 URL | string | http://localhost:8000 |
game.json — 游戏配置
| 配置项 | 描述 | 类型 | 默认值 |
|---|---|---|---|
EnableRelax | 启用 RX mod 统计数据 | boolean | false |
EnableAutopilot | 启用 AP mod 统计数据 | boolean | false |
EnableAllBeatmapLeaderboard | 启用所有谱面的排行榜 | boolean | false |
realtime.json — 实时游戏服务器配置
| 配置项 | 描述 | 类型 | 默认值 |
|---|---|---|---|
SaveReplays | 是否保存回放。 | boolean | true |
ReplayUploaderConcurrency | 回放上传的并发数 | integer | 4 |
MaxStartedScores | 单个会话中最大同时开始的成绩数量 | integer | 2 |
HostPlaylistLimit | 房主可添加到游玩列表的数量上限 | integer | 50 |
GuestPlaylistLimit | 玩家可添加到游玩列表的数量上限 | integer | 3 |
MultiplayerDisconnectGracePeriod | 多人房间中玩家断线后的保留时间(hh:mm:ss)。 | string | 00:00:30 |
TournamentRoomRetentionPeriod | 比赛房间结束后保留的时间(hh:mm:ss)。 | string | 00:30:00 |
Sentry.Dsn | Sentry DSN,留空则禁用 Sentry 错误监控 | string | "" |
Sentry.Environment | Sentry 环境标签(如 "production")。 | string | "" |
Sentry.TracesSampleRate | Sentry 性能追踪采样率,取值 0–1 | float | 0.1 |
Sentry.SendDefaultPii | 是否向 Sentry 发送默认的个人身份信息(PII) | boolean | false |
chat.json — 聊天配置(可选)
可选配置文件:不提供该文件时,聊天配置使用来自 osu-web 的默认值。
| 配置项 | 描述 | 类型 | 默认值 |
|---|---|---|---|
ChannelLimit | 客户端可加入的频道数量上限 | integer | 10000 |
MessageLengthLimit | 单条消息的最大长度 | integer | 450 |
AnnounceMessageLengthLimit | 公告消息的最大长度 | integer | 1024 |
PublicBacklogLimitHours | 公共频道消息历史的保留时间(小时) | integer | 24 |
ActivityTimeoutSeconds | 频道活跃超时时间(秒),超时后频道将被关闭 | integer | 60 |
RecentMessageLimit | 加入频道时附带返回的最近消息数量 | integer | 50 |
PublicMessageLimit | 公共频道在限速窗口内允许发送的消息条数 | integer | 1 |
PublicMessageWindowSeconds | 公共频道的限速窗口长度(秒) | integer | 1 |
PrivateMessageLimit | 私信在限速窗口内允许发送的消息条数 | integer | 1 |
PrivateMessageWindowSeconds | 私信的限速窗口长度(秒) | integer | 1 |
storage.json — 存储配置
用于存储回放文件、头像等静态资源。
| 配置项 | 描述 | 类型 | 默认值 |
|---|---|---|---|
Type | 存储服务类型:local、r2、s3 | enum(Local, S3, R2) | Local |
| 本地存储 | |||
local_storage_path | 本地存储目录路径 | string | ./storage |
| Amazon S3 | |||
s3_access_key_id | AWS Access Key ID | string | "" |
s3_secret_access_key | AWS Secret Access Key | string | "" |
s3_bucket_name | S3 存储桶名称 | string | "" |
s3_region_name | S3 区域(region),例如 us-east-1 | string | us-east-1 |
s3_public_url_base | S3 公共访问 URL 前缀(可选),用于生成可直接访问的静态资源链接 | string | "" |
| Cloudflare R2 | |||
r2_account_id | Cloudflare 账户 ID | string | "" |
r2_access_key_id | R2 Access Key ID | string | "" |
r2_secret_access_key | R2 Secret Access Key | string | "" |
r2_bucket_name | R2 存储桶名称 | string | "" |
r2_public_url_base | R2 公共访问 URL 前缀(可选),用于生成可直接访问的静态资源链接 | string | "" |