#[default(None)]
#[doku(skip)]
pub opentelemetry_url: Option<Url>,
+ /// The number of activitypub federation workers that can be in-flight concurrently
+ #[default(0)]
+ pub worker_count: usize,
+ /// The number of activitypub federation retry workers that can be in-flight concurrently
+ #[default(0)]
+ pub retry_count: usize,
}
#[derive(Debug, Deserialize, Serialize, Clone, SmartDefault, Document)]
-#[serde(default)]
+#[serde(default, deny_unknown_fields)]
pub struct PictrsConfig {
/// Address where pictrs is available (for image hosting)
#[default(Url::parse("http://localhost:8080").expect("parse pictrs url"))]
#[derive(Debug, Deserialize, Serialize, Clone, SmartDefault, Document)]
#[serde(default)]
pub struct DatabaseConfig {
+ #[serde(flatten, default)]
+ pub connection: DatabaseConnection,
+
+ /// Maximum number of active sql connections
+ #[default(5)]
+ pub pool_size: usize,
+}
+
+#[derive(Debug, Deserialize, Serialize, Clone, SmartDefault, Document)]
+#[serde(untagged)]
+pub enum DatabaseConnection {
+ /// Configure the database by specifying a URI
+ ///
+ /// This is the preferred method to specify database connection details since
+ /// it is the most flexible.
+ Uri {
+ /// Connection URI pointing to a postgres instance
+ ///
+ /// This example uses peer authentication to obviate the need for creating,
+ /// configuring, and managing passwords.
+ ///
+ /// For an explanation of how to use connection URIs, see [here][0] in
+ /// PostgreSQL's documentation.
+ ///
+ /// [0]: https://www.postgresql.org/docs/current/libpq-connect.html#id-1.7.3.8.3.6
+ #[doku(example = "postgresql:///lemmy?user=lemmy&host=/var/run/postgresql")]
+ uri: String,
+ },
+
+ /// Configure the database by specifying parts of a URI
+ ///
+ /// Note that specifying the `uri` field should be preferred since it provides
+ /// greater control over how the connection is made. This merely exists for
+ /// backwards-compatibility.
+ #[default]
+ Parts(DatabaseConnectionParts),
+}
+
+#[derive(Debug, Deserialize, Serialize, Clone, SmartDefault, Document)]
+#[serde(default)]
+pub struct DatabaseConnectionParts {
/// Username to connect to postgres
#[default("lemmy")]
pub(super) user: String,
/// Name of the postgres database for lemmy
#[default("lemmy")]
pub(super) database: String,
- /// Maximum number of active sql connections
- #[default(5)]
- pub pool_size: usize,
}
#[derive(Debug, Deserialize, Serialize, Clone, Document, SmartDefault)]
+#[serde(deny_unknown_fields)]
pub struct EmailConfig {
/// Hostname and port of the smtp server
#[doku(example = "localhost:25")]
}
#[derive(Debug, Deserialize, Serialize, Clone, SmartDefault, Document)]
+#[serde(deny_unknown_fields)]
pub struct SetupConfig {
/// Username for the admin user
#[doku(example = "admin")]