handle postgres without password

fixes #4
This commit is contained in:
Robin Appelman 2023-03-30 13:03:48 +02:00
commit 39e4ae9a2b
4 changed files with 46 additions and 3 deletions

View file

@ -216,8 +216,12 @@ impl From<Database> for sqlx::any::AnyConnectOptions {
} => {
let mut options = PgConnectOptions::default()
.database(&database)
.username(&username)
.password(&password);
.username(&username);
if !password.is_empty() {
options = options.password(&password);
}
if matches!(ssl_options, SslOptions::Disabled) {
options = options.ssl_mode(PgSslMode::Disable);
}