Skip to main content

Config

Struct Config 

Source
pub struct Config {
Show 17 fields pub bind: SocketAddr, pub db_path: PathBuf, pub public_url: String, pub allowed_dids: Vec<String>, pub poll_interval: Duration, pub retention_days: u32, pub proxy_images: bool, pub beta_cap: i64, pub trusted_ip_header: Option<String>, pub max_subs_per_did: i64, pub max_feeds_global: i64, pub max_entries_per_feed: i64, pub db_size_watermark_bytes: i64, pub sidecar: SidecarConfig, pub cookie_secret: String, pub dev_did: Option<String>, pub resolver_base: String,
}
Expand description

Fully-resolved server configuration, materialized once at startup.

Fields§

§bind: SocketAddr

The socket address the HTTP server binds to.

§db_path: PathBuf

Filesystem path to the SQLite cache/database file.

§public_url: String

The externally-reachable base URL (used to build the atproto OAuth callback and client-metadata URLs). No trailing slash.

§allowed_dids: Vec<String>

Optional login allow-list of atproto DIDs. Empty means the instance is open to any atproto identity that can log in.

§poll_interval: Duration

The default per-feed poll interval.

§retention_days: u32

Retention window: read, unstarred entries older than this are pruned.

§proxy_images: bool

Whether to proxy feed images through the server (privacy vs. bandwidth).

§beta_cap: i64

Closed-beta seat cap: the maximum number of DIDs that may hold beta access at once (redeeming an invite fails with CapacityFull past this). From FEATHERREADER_BETA_CAP, default 100.

§trusted_ip_header: Option<String>

The reverse-proxy header the rate limiter TRUSTS for the real client IP, e.g. Fly-Client-IP (bare Fly) or CF-Connecting-IP (Cloudflare). When set, ONLY this header is consulted — never the spoofable multi-hop X-Forwarded-For chain — and it falls back to the socket peer if the header is absent/unparseable. Unset (the default) trusts the socket peer only, which is correct for a direct bind with no proxy in front. From FEATHERREADER_TRUSTED_IP_HEADER.

§max_subs_per_did: i64

Per-DID subscription cap. A DID may hold at most this many subscriptions; add_subscription rejects over it and import_opml trims to it. Bounds the storage/poller blast radius of one account on a small box. From FEATHERREADER_MAX_SUBS_PER_DID, default 500.

§max_feeds_global: i64

Global ceiling on distinct feeds in the shared cache. A new feed is refused once the feeds table holds this many rows (existing feeds still poll). From FEATHERREADER_MAX_FEEDS, default 10_000.

§max_entries_per_feed: i64

Cap on how many entries are retained per feed on insert — the newest N by published date; older rows are pruned in the same transaction so one firehose feed can’t fill the disk. From FEATHERREADER_MAX_ENTRIES_PER_FEED, default 2_000.

§db_size_watermark_bytes: i64

DB-size watermark, in bytes. Above it the background poller stops fetching new content (and logs an alert) so the $3.50 box can’t be filled to a crash. 0 disables the watermark. From FEATHERREADER_DB_SIZE_WATERMARK_BYTES, default 2 GiB.

§sidecar: SidecarConfig

The atproto OAuth sidecar wiring (base URL + shared internal secret).

§cookie_secret: String

HMAC key used to sign the session cookie. In production this MUST be set (FEATHERREADER_COOKIE_SECRET); a stable dev fallback is used otherwise so local runs work without configuration.

§dev_did: Option<String>

Optional dev-only DID: when set, a request with no valid session cookie is served as this DID (local runs without the OAuth sidecar). Unset in a real deployment — no session then means “logged out”.

§resolver_base: String

Base URL of the atproto handle resolver (com.atproto.identity.resolveHandle), no trailing slash. Used by the pre-handshake beta gate to turn a submitted handle into a DID so an existing seat can be honored on a cookie-less first login. Defaults to crate::atproto::DEFAULT_RESOLVER_HOST. From FEATHERREADER_RESOLVER_HOST.

Implementations§

Source§

impl Config

Source

pub fn from_env() -> Result<Self>

Build a Config from the process environment, falling back to the defaults above for anything unset. Returns an error only when a present variable fails to parse — an unset variable is never an error.

Source

pub fn did_allowed(&self, did: &str) -> bool

Whether the given atproto DID is permitted to log in. When no allow-list is configured the instance is open, so every DID is allowed.

Source

pub fn admin_seed_dids(&self) -> &[String]

The admin-bootstrap seed for the closed-beta gate: the DIDs that get a beta_access seat automatically (via crate::store::ensure_seed) so a fresh instance always has at least the operator(s) inside the gate and able to mint invite codes.

Reuses ALLOWED_DIDS as the seed source — the same “these are the people I trust on this instance” concept — so operators don’t configure the list twice. Returns a borrowed slice (empty when the instance is open / no allow-list is set, in which case there is nothing to seed).

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

impl Default for Config

Source§

fn default() -> Self

Returns the “default value” for a type. 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