Skip to content

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 数据库。booleantrue
MySqlHostMySQL 服务器地址string127.0.0.1
MySqlPortMySQL 服务器端口string3306
MySqlDatabaseMySQL 数据库名称stringosu_api
MySqlUsernameMySQL 用户名stringosu_api
MySqlPasswordMySQL 密码stringpassword
PostgresqlConnectionStringPostgreSQL 连接字符串(UseLegacyDatabase 为 false 时使用)。格式:Host=...;Port=...;Username=...;Password=...;Database=...stringHost=localhost;Port=5432;Username=g0v0;Password=password;Database=g0v0
RedisHostRedis 连接 URLstringlocalhost:6379
JwtSecretKeyJWT 签名密钥stringyour_jwt_secret_here
JwtAlgorithmJWT 算法stringHS256
JwtAudienceJWT 受众string5
JwtIssuerJWT 签发者stringnull
OsuClientIdOAuth 客户端 IDinteger5
OsuClientSecretOAuth 客户端密钥stringFGc9GAtyHzeQDshWP5Ah7dega8hJACAJpQtw6OXk
OsuWebClientIdWeb OAuth 客户端 IDinteger6
OsuWebClientSecretWeb OAuth 客户端密钥stringyour_osu_web_client_secret_here
FetcherClientIdFetcher 客户端 IDinteger0
FetcherClientSecretFetcher 客户端密钥string""
FetcherBeatmapRawCacheExpireHours谱面缓存过期时间(小时)integer24
ServerUrl服务器 URLstringhttp://localhost:8000

game.json — 游戏配置

配置项描述类型默认值
EnableRelax启用 RX mod 统计数据booleanfalse
EnableAutopilot启用 AP mod 统计数据booleanfalse
EnableAllBeatmapLeaderboard启用所有谱面的排行榜booleanfalse

realtime.json — 实时游戏服务器配置

配置项描述类型默认值
SaveReplays是否保存回放。booleantrue
ReplayUploaderConcurrency回放上传的并发数integer4
MaxStartedScores单个会话中最大同时开始的成绩数量integer2
HostPlaylistLimit房主可添加到游玩列表的数量上限integer50
GuestPlaylistLimit玩家可添加到游玩列表的数量上限integer3
MultiplayerDisconnectGracePeriod多人房间中玩家断线后的保留时间(hh:mm:ss)。string00:00:30
TournamentRoomRetentionPeriod比赛房间结束后保留的时间(hh:mm:ss)。string00:30:00
Sentry.DsnSentry DSN,留空则禁用 Sentry 错误监控string""
Sentry.EnvironmentSentry 环境标签(如 "production")。string""
Sentry.TracesSampleRateSentry 性能追踪采样率,取值 0–1float0.1
Sentry.SendDefaultPii是否向 Sentry 发送默认的个人身份信息(PII)booleanfalse

chat.json — 聊天配置(可选)

可选配置文件:不提供该文件时,聊天配置使用来自 osu-web 的默认值。

配置项描述类型默认值
ChannelLimit客户端可加入的频道数量上限integer10000
MessageLengthLimit单条消息的最大长度integer450
AnnounceMessageLengthLimit公告消息的最大长度integer1024
PublicBacklogLimitHours公共频道消息历史的保留时间(小时)integer24
ActivityTimeoutSeconds频道活跃超时时间(秒),超时后频道将被关闭integer60
RecentMessageLimit加入频道时附带返回的最近消息数量integer50
PublicMessageLimit公共频道在限速窗口内允许发送的消息条数integer1
PublicMessageWindowSeconds公共频道的限速窗口长度(秒)integer1
PrivateMessageLimit私信在限速窗口内允许发送的消息条数integer1
PrivateMessageWindowSeconds私信的限速窗口长度(秒)integer1

storage.json — 存储配置

用于存储回放文件、头像等静态资源。

配置项描述类型默认值
Type存储服务类型:local、r2、s3enum(Local, S3, R2)Local
本地存储
local_storage_path本地存储目录路径string./storage
Amazon S3
s3_access_key_idAWS Access Key IDstring""
s3_secret_access_keyAWS Secret Access Keystring""
s3_bucket_nameS3 存储桶名称string""
s3_region_nameS3 区域(region),例如 us-east-1stringus-east-1
s3_public_url_baseS3 公共访问 URL 前缀(可选),用于生成可直接访问的静态资源链接string""
Cloudflare R2
r2_account_idCloudflare 账户 IDstring""
r2_access_key_idR2 Access Key IDstring""
r2_secret_access_keyR2 Secret Access Keystring""
r2_bucket_nameR2 存储桶名称string""
r2_public_url_baseR2 公共访问 URL 前缀(可选),用于生成可直接访问的静态资源链接string""

Released under the MIT License