pub struct Config {
pub addr: SocketAddr,
pub database_url: String,
pub agents: String,
pub max_batch_days: usize,
pub max_body_bytes: usize,
pub admin: String,
pub secure_cookies: bool,
}Expand description
Runtime configuration, read from the environment.
Fields§
§addr: SocketAddrAddress the HTTP server binds to (KASL_SERVER_ADDR).
database_url: StringPostgreSQL connection string (DATABASE_URL).
agents: StringAgents to provision on startup (KASL_AGENTS), as email:token pairs.
The bootstrap way in until the admin UI issues tokens.
max_batch_days: usizeDays one batch upload may carry (KASL_MAX_BATCH_DAYS).
max_body_bytes: usizeLargest request body accepted (KASL_MAX_BODY_BYTES).
admin: StringBootstrap administrator (KASL_ADMIN), as email:password.
Whether session cookies carry Secure (KASL_SECURE_COOKIES).
On by default, because a server holding a team’s hours belongs behind
TLS. Turned off only for a stand reached over plain http, where a
Secure cookie is dropped by the browser and login silently does
nothing at all.
Implementations§
Source§impl Config
impl Config
pub fn from_env() -> Result<Self>
Sourcepub fn defaults_for_database(database_url: String) -> Self
pub fn defaults_for_database(database_url: String) -> Self
A configuration with every limit at its default. Used where the limits are not the subject - the router built for tests, for instance - so the defaults live in one place rather than being restated.
Trait Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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