Alternative ATProto PDS implementation
at oauth 2.1 kB view raw
1//! Configuration structures for the PDS. 2/// The metrics configuration. 3pub(crate) mod metrics { 4 use super::{Deserialize, Url}; 5 6 #[derive(Deserialize, Debug, Clone)] 7 /// The Prometheus configuration. 8 pub(crate) struct PrometheusConfig { 9 /// The URL of the Prometheus server's exporter endpoint. 10 pub url: Url, 11 } 12} 13 14use serde::Deserialize; 15use std::{net::SocketAddr, path::PathBuf}; 16use url::Url; 17 18#[derive(Deserialize, Debug, Clone)] 19#[serde(tag = "type")] 20/// Configuration for metrics. 21pub(crate) enum MetricConfig { 22 /// The Prometheus push gateway. 23 PrometheusPush(metrics::PrometheusConfig), 24} 25 26#[derive(Deserialize, Debug, Clone)] 27pub(crate) struct FirehoseConfig { 28 /// A list of upstream relays that this PDS will try to reach out to. 29 pub relays: Vec<Url>, 30} 31 32#[derive(Deserialize, Debug, Clone)] 33pub(crate) struct RepoConfig { 34 /// The path to the repository storage. 35 pub path: PathBuf, 36} 37 38#[derive(Deserialize, Debug, Clone)] 39pub(crate) struct PlcConfig { 40 /// The path to the local PLC cache. 41 pub path: PathBuf, 42} 43 44#[derive(Deserialize, Debug, Clone)] 45pub(crate) struct BlobConfig { 46 /// The maximum size limit of blobs. 47 pub limit: u64, 48 /// The path to store blobs into. 49 pub path: PathBuf, 50} 51 52#[derive(Deserialize, Debug, Clone)] 53pub(crate) struct AppConfig { 54 /// The blob configuration block. 55 pub blob: BlobConfig, 56 /// The sqlite database connection options. 57 pub db: String, 58 /// The firehose configuration block. 59 pub firehose: FirehoseConfig, 60 /// The hostname of the PDS. Typically a domain name. 61 pub host_name: String, 62 /// The primary signing keys for all PLC/DID operations. 63 pub key: PathBuf, 64 /// The listen address for the PDS. 65 pub listen_address: Option<SocketAddr>, 66 /// The metrics configuration block. 67 pub metrics: Option<MetricConfig>, 68 /// The PLC configuration block. 69 pub plc: PlcConfig, 70 /// The repo configuration block. 71 pub repo: RepoConfig, 72 /// Test mode. 73 pub test: bool, 74}