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: StringImplementations§
Source§impl Config
impl Config
Sourcepub fn load() -> Result<Self, String>
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