diff options
author | Vika <vika@fireburn.ru> | 2025-01-01 08:18:42 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2025-01-01 08:18:42 +0300 |
commit | 585ae01da68bb091e75ab0c2cf38f503114a043c (patch) | |
tree | 12b104afcd37f68e0e494ec5b1bd1b9018f2792c /src/webmentions/queue.rs | |
parent | 56258dad4ce7492df3e06c45865015cbb1e588fe (diff) | |
download | kittybox-585ae01da68bb091e75ab0c2cf38f503114a043c.tar.zst |
PGPASS → PGPASSWORD
Turns out sqlx natively reads a plaintext password from this variable, otherwise from the `$PGPASSFILE`, otherwise from `$HOME/.pgpass`, so I don't need custom logic around passwords. Yay for sqlx being smart! Change-Id: I14858903ea1605469f9ea8095dc3bb056f617e85
Diffstat (limited to 'src/webmentions/queue.rs')
-rw-r--r-- | src/webmentions/queue.rs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/webmentions/queue.rs b/src/webmentions/queue.rs index dfa2a48..52bcdfa 100644 --- a/src/webmentions/queue.rs +++ b/src/webmentions/queue.rs @@ -113,14 +113,9 @@ impl<T> Clone for PostgresJobQueue<T> { impl PostgresJobQueue<Webmention> { pub async fn new(uri: &url::Url) -> Result<Self, sqlx::Error> { - let mut options = sqlx::postgres::PgConnectOptions::from_url(uri)? + let options = sqlx::postgres::PgConnectOptions::from_url(uri)? .options([("search_path", "kittybox_webmention")]); - if let Ok(password_file) = std::env::var("PGPASS_FILE") { - let password = tokio::fs::read_to_string(password_file).await.unwrap(); - options = options.password(&password); - } else if let Ok(password) = std::env::var("PGPASS") { - options = options.password(&password) - } + Self::from_pool( sqlx::postgres::PgPoolOptions::new() .max_connections(50) |