Config

Struct Config 

Source
pub struct Config {
Show 16 fields pub host: String, pub port: u16, pub files_dir: PathBuf, pub database_path: String, pub default_ttl_hours: u32, pub max_ttl_hours: u32, pub max_file_size_bytes: u64, pub rate_limit_per_minute: u32, pub db_pool_size: u32, pub public_base_url: String, pub log_level: String, pub cleanup_interval_minutes: u64, pub juicehost_api_key: String, pub juicehost_url: String, pub juiceback_origin: String, pub jwt_secret: String,
}
Expand description

Holds every setting juiceback needs to run.

All values come from environment variables with sensible fallbacks. Check out Config::load to see what variables are available.

Fields§

§host: String§port: u16§files_dir: PathBuf§database_path: String§default_ttl_hours: u32§max_ttl_hours: u32§max_file_size_bytes: u64§rate_limit_per_minute: u32§db_pool_size: u32§public_base_url: String§log_level: String§cleanup_interval_minutes: u64§juicehost_api_key: String§juicehost_url: String§juiceback_origin: String§jwt_secret: String

Implementations§

Source§

impl Config

Source

pub fn load() -> Result<Self, String>

Load settings from the environment.

Here are the environment variables it reads:
HOST (default 127.0.0.1) - TCP bind address
PORT (default 6401) - TCP bind port, QUIC on UDP 6402
FILES_DIR (default ./files) - temp file directory
DATABASE_PATH (default ./delta.db) - SQLite database file
DEFAULT_TTL_HOURS (default 72) - how long files live
MAX_TTL_HOURS (default 168) - max retention a user can pick
MAX_FILE_SIZE_MB (default 500) - max upload size
RATE_LIMIT_PER_MINUTE (default 10) - uploads per IP per minute
DB_POOL_SIZE (default 8) - connection pool size
PUBLIC_BASE_URL (default http://localhost:6402) - public juicehost URL LOG_LEVEL (default info) - log filter CLEANUP_INTERVAL_MINUTES (default 30) - how often expired files get cleaned JUICEHOST_API_KEY - shared secret for juicehost auth JUICEHOST_URL (default http://127.0.0.1:6402) - internal juicehost URL JUICEBACK_ORIGIN - origin header sent to juicehost JWT_SECRET - JWT signing key, auto-generates if you leave it unset

Trait Implementations§

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§

§

impl Freeze for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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.

§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: 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, 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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

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

§

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

§

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