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

@ -177,6 +177,31 @@ fn test_parse_postgres_socket() {
);
}
#[test]
fn test_parse_postgres_socket_no_pass() {
let config = config_from_file("tests/configs/postgres_socket_no_pass.php");
assert_debug_equal(
&Database::Postgres {
database: "nextcloud".to_string(),
username: "redacted".to_string(),
password: "".to_string(),
connect: DbConnect::Socket("/var/run/postgresql".into()),
ssl_options: SslOptions::Default,
},
&config.database,
);
#[cfg(feature = "db-sqlx")]
assert_debug_equal(
AnyConnectOptions::from(
PgConnectOptions::new()
.socket("/var/run/postgresql")
.username("redacted")
.database("nextcloud"),
),
config.database.into(),
);
}
#[test]
fn test_parse_postgres_socket_folder() {
let config = config_from_file("tests/configs/postgres_socket_folder.php");

View file

@ -0,0 +1,14 @@
<?php
$CONFIG = [
'overwrite.cli.url' => 'https://cloud.example.com',
'dbtype' => 'pgsql',
'dbname' => 'nextcloud',
'dbhost' => 'localhost:/var/run/postgresql/.s.PGSQL.5432',
'dbport' => '',
'dbtableprefix' => 'oc_',
'dbuser' => 'redacted',
'redis' => [
'host' => 'localhost'
]
];