Skip to main content

Config

Struct Config 

Source
pub struct Config {
Show 40 fields pub database_url: String, pub data_dir: PathBuf, pub recordings_dir: PathBuf, pub clips_dir: PathBuf, pub snapshots_dir: PathBuf, pub frames_dir: PathBuf, pub ffmpeg_bin: String, pub ffprobe_bin: String, pub mediamtx_api_url: String, pub mediamtx_hls_base: String, pub mediamtx_rtsp_base: String, pub mediamtx_webrtc_base: String, pub db_max_connections: u32, pub recorder_enabled: bool, pub default_segment_seconds: i64, pub default_retention_hours: i64, pub indexer_interval_s: u64, pub health_interval_s: u64, pub retention_interval_s: u64, pub api_host: String, pub api_port: u16, pub cors_origins: Vec<String>, pub max_recordings_bytes: u64, pub min_free_disk_bytes: u64, pub alert_webhook_url: Option<String>, pub notifier_interval_s: u64, pub ai_enabled: bool, pub ai_max_total_fps: f64, pub default_ai_fps: f64, pub default_ai_width: i64, pub detection_retention_hours: i64, pub auth_enabled: bool, pub session_ttl_hours: i64, pub auth_cookie_secure: bool, pub bootstrap_admin_user: Option<String>, pub bootstrap_admin_password: Option<String>, pub audit_retention_days: i64, pub overlay_enabled: bool, pub overlay_kind: String, pub overlay_iface: Option<String>,
}
Expand description

Runtime configuration, loaded from environment (see .env.example).

Fields§

§database_url: String§data_dir: PathBuf§recordings_dir: PathBuf§clips_dir: PathBuf§snapshots_dir: PathBuf§frames_dir: PathBuf§ffmpeg_bin: String§ffprobe_bin: String§mediamtx_api_url: String§mediamtx_hls_base: String§mediamtx_rtsp_base: String§mediamtx_webrtc_base: String§db_max_connections: u32

Max SQLite pool connections. Tunable per deployment: more absorbs bursts of concurrent requests (WAL serves reads concurrently; writes still serialize), at the cost of memory.

§recorder_enabled: bool§default_segment_seconds: i64§default_retention_hours: i64§indexer_interval_s: u64§health_interval_s: u64§retention_interval_s: u64§api_host: String§api_port: u16§cors_origins: Vec<String>§max_recordings_bytes: u64

Soft cap on total recording footprint; oldest unlocked segments are pruned above this.

§min_free_disk_bytes: u64

Hard floor on free disk space; when free space drops below this, oldest unlocked segments are pruned regardless of age/size policy (protects the host from a full disk).

§alert_webhook_url: Option<String>

Optional webhook URL that receives warning/critical events as JSON (alerting).

§notifier_interval_s: u64

How often the alert notifier polls for new events to deliver.

§ai_enabled: bool

Master switch for AI frame sampling (Stage 2). Cameras still need an enabled AI task.

§ai_max_total_fps: f64

Global frame-sampling budget (frames/sec summed across all cameras); per-camera fps is reduced proportionally above this so adding AI cameras degrades fps instead of overloading.

§default_ai_fps: f64§default_ai_width: i64§detection_retention_hours: i64

How long detection rows are kept before the retention sweeper prunes them.

§auth_enabled: bool

Master switch for authentication + RBAC. When false, the API is open (dev/single-tenant LAN appliance default) and a synthetic admin principal is used. When true, the auth/admin surface requires a valid bearer token (session or API key) and enforces roles.

§session_ttl_hours: i64

Lifetime of an issued login session token.

§auth_cookie_secure: bool

Add Secure to the session cookie (require HTTPS). Default false for HTTP LAN/overlay appliances; set true when the deployment is served over TLS.

§bootstrap_admin_user: Option<String>

Optional first-run admin bootstrap (only used when no users exist yet).

§bootstrap_admin_password: Option<String>§audit_retention_days: i64

How long kernel audit-log + generic-event rows are kept before retention prunes them.

§overlay_enabled: bool

Whether this deployment is reached through a WireGuard overlay (Tailscale / NetBird / wireguard) running as an external daemon on the host. The kernel does not manage the overlay; it only reports whether the configured interface is present + up so the dashboard can surface remote-access health. When false, the deployment is LAN-only.

§overlay_kind: String

Label for the overlay in use: tailscale | netbird | wireguard | none.

§overlay_iface: Option<String>

The overlay’s network interface to probe (e.g. tailscale0, wt0, wg0).

Implementations§

Source§

impl Config

Source

pub fn from_env() -> Self

Source

pub fn camera_recordings_dir(&self, camera_id: &str) -> PathBuf

Directory where a camera’s segments are stored.

Source

pub fn camera_frames_dir(&self, camera_id: &str) -> PathBuf

Directory where a camera’s sampled AI frames are written.

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

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

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<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> 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<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

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> 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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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