Skip to main content

Config

Struct Config 

Source
pub struct Config {
Show 29 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 site_name: String, 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>,
}

Fields§

§database_url: String

Postgres URL: the site’s Neon database. 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: String

The site’s schema (players, API tokens, sessions).

§schema: String

This server’s own schema (games, challenges, ratings, fair play).

§pool_size: usize§public_url: String

Where 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: String

The site whose players and sign-ins this server uses, for “sign in first” links on the OAuth page.

§esports_login: bool

Sign in through the host site (esports-lab): the OAuth page accepts the site’s session cookie and links to its sign-in. Off by default, so a server without that site offers no browser sign-in; API tokens (the site’s, and open-chess bot create) work either way.

§site_name: String

What players know the site as: on the OAuth page, in PGN event names and in GET / (which the training app shows).

§bind: String§metrics_bind: String

/metrics, /healthz and /readyz.

§lag_comp_ms: i64

Milliseconds given back per move for the network round trip.

§challenge_ttl_secs: u64

A real-time challenge lapses after this many seconds unless the challenger keeps a keepAliveStream open.

§first_move_secs: u64

Each side’s first move must come within this many seconds or the game is aborted.

§gone_after_secs: u64

A player with no open game stream for this long is “gone”.

§claim_win_secs: u64

Then the opponent may claim the win after this many more seconds.

§public_delay_plies: usize

The public move stream runs this many plies behind a live game, so it can’t feed an engine helping a player.

§fairplay: bool

Queue human players’ finished games for fair-play analysis.

§block_marked: bool

Accounts marked for engine use can’t start new games.

§sweep_ms: u64

How often the clock sweeper looks for flags and lapsed challenges.

§vision_endpoint: String

Reading 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: String

The 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: String

Our 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: f32

The 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: bool

Keep 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: i64

At most this many photos wait for review; beyond it, new ones aren’t kept.

§tablebase_url: String

Where 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.

Implementations§

Source§

impl Config

Source

pub fn base_path(&self) -> Result<String>

The path the API lives under (/chess, or empty).

Source

pub fn public_url(&self) -> &str

Source

pub fn challenge_ttl(&self) -> Duration

Source

pub fn validate(&self) -> Result<()>

Trait Implementations§

Source§

impl Args for Config

Source§

fn group_id() -> Option<Id>

Report the ArgGroup::id for this set of arguments
Source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate Self via FromArgMatches::from_arg_matches_mut Read more
Source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate self via FromArgMatches::update_from_arg_matches_mut Read more
Source§

impl Clone for Config

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromArgMatches for Config

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more