pub struct Config {Show 45 fields
pub database_url: String,
pub listen_database_url: Option<String>,
pub site_schema: String,
pub schema: String,
pub pool_size: usize,
pub public_url: String,
pub site_url: String,
pub esports_login: bool,
pub esports_secret: Option<String>,
pub signup: bool,
pub site_name: String,
pub host_name: Option<String>,
pub admin_emails: Vec<String>,
pub staff_passkey_hours: i32,
pub bind: String,
pub metrics_bind: String,
pub lag_comp_ms: i64,
pub challenge_ttl_secs: u64,
pub first_move_secs: u64,
pub gone_after_secs: u64,
pub claim_win_secs: u64,
pub public_delay_plies: usize,
pub fairplay: bool,
pub block_marked: bool,
pub sweep_ms: u64,
pub vision_endpoint: String,
pub vision_model: String,
pub vision_api_key: Option<String>,
pub vision_local_model: String,
pub vision_min_confidence: f32,
pub vision_review: bool,
pub vision_review_max: i64,
pub tablebase_url: String,
pub app_dir: Option<String>,
pub app_theme: Option<String>,
pub apns_key: Option<String>,
pub apns_key_id: Option<String>,
pub apns_team_id: Option<String>,
pub apns_topic: String,
pub apple_key: Option<String>,
pub apple_key_id: Option<String>,
pub apple_team_id: Option<String>,
pub apple_client_ids: Vec<String>,
pub apple_services_id: Option<String>,
pub apple_url: String,
}Fields§
§database_url: StringPostgres URL: this server’s database (its own; it may share a host
site’s database in its own schema). A pooled (-pooler) host is
fine; notifications use the direct host automatically.
listen_database_url: Option<String>A separate URL for LISTEN, if the direct host can’t be derived.
site_schema: StringA host site’s schema in the same database whose chess players (and their chess tokens) are imported once, with their ids, the first time this version starts. Nothing is read from it afterwards; a schema that isn’t there is skipped.
schema: StringThis server’s own schema (games, challenges, ratings, fair play).
pool_size: usize§public_url: StringWhere clients reach this server, including any path prefix
(https://chess.example.com). Used in game URLs and
to mount the API under the prefix.
site_url: StringThe host site (esports-lab) players can sign in with.
esports_login: bool“Sign in with the host site” (esports-lab): its players sign in
here through it, and its server gets tokens for them. Needs
ESPORTS_SECRET. Off by default (the site is private); the
server’s own accounts work either way.
esports_secret: Option<String>The secret shared with the host site: it signs sign-ins and asks for its players’ tokens with it (at least 32 characters).
signup: boolAnyone may make an account here (a name and a password). Off: only
accounts that exist (and the host site’s players, with
ESPORTS_LOGIN) sign in.
site_name: StringWhat players know the site as: on the OAuth page, in PGN event
names and in GET / (which the training app shows).
host_name: Option<String>What players know the host site as (esports-lab), when they can sign in with it: “Sign in with …”, “linked to your … account”. The site name when unset.
admin_emails: Vec<String>People made admins here, by email (comma-separated): an account gets
the admin role when it signs in with one of these, once the email is
confirmed (a host site’s sign-in vouches for it) and it has a
passkey. Accounts made here have unconfirmed emails: make them admins
with open-chess admin grant.
staff_passkey_hours: i32Hours an admin’s or manager’s passkey check lasts.
bind: String§metrics_bind: String/metrics, /healthz and /readyz.
lag_comp_ms: i64Milliseconds given back per move for the network round trip.
challenge_ttl_secs: u64A real-time challenge lapses after this many seconds unless the
challenger keeps a keepAliveStream open.
first_move_secs: u64Each side’s first move must come within this many seconds or the game is aborted.
gone_after_secs: u64A player with no open game stream for this long is “gone”.
claim_win_secs: u64Then the opponent may claim the win after this many more seconds.
public_delay_plies: usizeThe public move stream runs this many plies behind a live game, so it can’t feed an engine helping a player.
fairplay: boolQueue human players’ finished games for fair-play analysis.
block_marked: boolAccounts marked for engine use can’t start new games.
sweep_ms: u64How often the clock sweeper looks for flags and lapsed challenges.
vision_endpoint: StringReading boards from photos: base URL of a vision model behind an
OpenAI-style /chat/completions (Claude via
https://api.anthropic.com/v1, Qwen-VL via Ollama’s
http://localhost:11434/v1, or a gateway). Empty: photo reading is
off.
vision_model: StringThe vision model’s name as that server knows it.
vision_api_key: Option<String>Bearer token for the vision server, if it needs one.
vision_local_model: StringOur own board reader (chess-vision): a .safetensors weights file
from chess-vision-train. It reads photos first, on this
server’s CPU; the vision model at CHESS_VISION_ENDPOINT (if set) is
only asked about photos it isn’t sure of. Empty: not used.
vision_min_confidence: f32The board reader’s answer is used without review when every square is above its unsure threshold and the chance that all 64 are right is at least this.
vision_review: boolKeep photos that couldn’t be read for sure for the Review page,
where a person confirms the position; confirmed photos become
training data (open-chess photos export). Players are told.
vision_review_max: i64At most this many photos wait for review; beyond it, new ones aren’t kept.
tablebase_url: StringWhere exact endgame results (up to seven pieces) come from: a Lichess-compatible tablebase server. Answers are kept in the database, so each position is fetched once. Empty: off.
app_dir: Option<String>The built training app (web/chess plus its wasm engine), served at
/app/. The chess image puts it at /usr/share/open-chess/app.
app_theme: Option<String>The app’s look for this deployment: a theme the app bundles, by name
(esports-lab: web/chess/themes), CSS, or the path of a .css file;
served as /app/theme.css, after the app’s own styles, so it can set
the app’s colour and font variables (docs/api.md, “The Chess lab’s
look”).
apns_key: Option<String>Apple push notifications for the iOS app (“your move” in
correspondence games, results to confirm): the .p8 signing key
(its PEM, or the path of the file) from the Apple Developer account.
Without it, and the three below, nothing is sent.
apns_key_id: Option<String>The key’s id (10 characters, shown with the key).
apns_team_id: Option<String>The Apple Developer team id.
apns_topic: StringThe app’s bundle id, which notifications are addressed to.
apple_key: Option<String>Sign in with Apple: the .p8 key made for it in the Apple Developer
account (Keys › Sign in with Apple; its PEM, or the path of the
file). With its id below (and the team id), the app’s “Sign in with
Apple” works; without them it’s refused.
apple_key_id: Option<String>The Sign in with Apple key’s id.
apple_team_id: Option<String>The Apple Developer team id (default: CHESS_APNS_TEAM_ID).
apple_client_ids: Vec<String>Who Apple’s sign-ins are for: the app’s bundle id (default: CHESS_APNS_TOPIC), comma-separated with any others accepted.
apple_services_id: Option<String>Sign in with Apple on the website (the sign-in and account pages):
the Services ID made for it, whose return URL is
{CHESS_PUBLIC_URL}/auth/apple/callback. Without it, only the app
signs in with Apple.
apple_url: StringApple’s sign-in service (only tests change it).
Implementations§
Source§impl Config
impl Config
pub fn public_url(&self) -> &str
Sourcepub fn admin_emails(&self) -> Vec<String>
pub fn admin_emails(&self) -> Vec<String>
CHESS_ADMIN_EMAILS, lower-cased.
Sourcepub fn esports(&self) -> Option<&str>
pub fn esports(&self) -> Option<&str>
The secret shared with the host site, when signing in with it is on.
pub fn challenge_ttl(&self) -> Duration
pub fn validate(&self) -> Result<()>
Trait Implementations§
Source§impl Args for Config
impl Args for Config
Source§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
Source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
fn augment_args_for_update<'b>(__clap_app: Command) -> Command
Command so it can instantiate self via
FromArgMatches::update_from_arg_matches_mut Read moreSource§impl FromArgMatches for Config
impl FromArgMatches for Config
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more