Document environment variable for database url (#5501)

This commit is contained in:
Nutomic 2025-03-13 12:11:58 +00:00 committed by GitHub
parent 5fa6a490d5
commit 7daa1c6543
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 16 deletions

View file

@ -1,15 +1,11 @@
{
# settings related to the postgresql database
database: {
# Configure the database by specifying URI pointing to a postgres instance
# Configure the database by specifying URI pointing to a postgres instance. This parameter can
# also be set by environment variable `LEMMY_DATABASE_URL`.
#
# 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
# For an explanation of how to use connection URIs, see PostgreSQL's documentation:
# https://www.postgresql.org/docs/current/libpq-connect.html#id-1.7.3.8.3.6
connection: "postgres://lemmy:password@localhost:5432/lemmy"
# Maximum number of active sql connections
pool_size: 30

View file

@ -143,15 +143,11 @@ pub enum PictrsImageMode {
#[derive(Debug, Deserialize, Serialize, Clone, SmartDefault, Document)]
#[serde(default, deny_unknown_fields)]
pub struct DatabaseConfig {
/// Configure the database by specifying URI pointing to a postgres instance
/// Configure the database by specifying URI pointing to a postgres instance. This parameter can
/// also be set by environment variable `LEMMY_DATABASE_URL`.
///
/// 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
/// For an explanation of how to use connection URIs, see PostgreSQL's documentation:
/// https://www.postgresql.org/docs/current/libpq-connect.html#id-1.7.3.8.3.6
#[default("postgres://lemmy:password@localhost:5432/lemmy")]
#[doku(example = "postgresql:///lemmy?user=lemmy&host=/var/run/postgresql")]
pub(crate) connection: String,