pub struct AppConfig {
pub app_name: String,
pub bind_addr: String,
pub database_url: String,
pub secret_key: String,
pub storage_dir: PathBuf,
pub assets_dir: PathBuf,
pub job_poll_interval_ms: u64,
pub job_concurrency: usize,
pub cookie_secure: bool,
pub webhooks_live: bool,
pub webhooks_allow_local: bool,
}Expand description
Runtime configuration loaded from SLABS_* and DATABASE_URL environment variables.
Fields§
§app_name: StringApplication name used for default database filenames, storage directories, and manifests.
bind_addr: StringSocket address to bind the HTTP server to (SLABS_BIND, default "127.0.0.1:3000").
database_url: StringConnection string for the primary database (DATABASE_URL, default "sqlite://{app_name}.db?mode=rwc").
secret_key: StringSecret key for signing cookies, tokens, and HMAC digests (SLABS_SECRET_KEY).
storage_dir: PathBufDirectory where uploaded blobs and local storage files are written (SLABS_STORAGE_DIR).
assets_dir: PathBufDirectory containing static assets such as CSS and JS files (SLABS_ASSETS_DIR).
job_poll_interval_ms: u64Polling interval in milliseconds for the background job worker (SLABS_JOB_POLL_MS, default 500).
job_concurrency: usizeMaximum number of background jobs executed concurrently (SLABS_JOB_CONCURRENCY, default 4).
Sets the Secure attribute on session cookies when true (SLABS_COOKIE_SECURE, default false).
webhooks_live: boolEnables live HTTP delivery for outbound webhooks when true (SLABS_WEBHOOKS_LIVE, default false).
webhooks_allow_local: boolAllows outbound webhooks to target loopback addresses when true (SLABS_WEBHOOKS_ALLOW_LOCAL, default false).
Implementations§
Source§impl AppConfig
impl AppConfig
Sourcepub fn from_env(app_name: impl Into<String>) -> Self
pub fn from_env(app_name: impl Into<String>) -> Self
Loads configuration from SLABS_* and DATABASE_URL environment variables.
Falls back to local development defaults derived from app_name when variables are unset.
Invalid numeric values for SLABS_JOB_POLL_MS or SLABS_JOB_CONCURRENCY also fall back to defaults.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AppConfig
impl<'de> Deserialize<'de> for AppConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Forget for AppConfig
impl Freeze for AppConfig
impl Move for AppConfig
impl RefUnwindSafe for AppConfig
impl Send for AppConfigwhere
RawVecInner: Send,
impl Sync for AppConfigwhere
RawVecInner: Sync,
impl Unpin for AppConfig
impl UnsafeUnpin for AppConfig
impl UnwindSafe for AppConfigwhere
RawVecInner: UnwindSafe,
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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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