better handling of postgres options

This commit is contained in:
Robin Appelman 2026-03-02 22:14:44 +01:00
commit a8f4622c1a
5 changed files with 86 additions and 37 deletions

View file

@ -4,6 +4,7 @@ use nextcloud_config_parser::{
};
use std::fmt::Debug;
use indexmap::{indexmap, IndexMap};
use redis::{ConnectionAddr, ConnectionInfo};
use sqlx::mysql::{MySqlConnectOptions, MySqlSslMode};
use sqlx::sqlite::SqliteConnectOptions;
@ -249,7 +250,7 @@ fn test_parse_postgres_socket() {
username: "redacted".to_string(),
password: "redacted".to_string(),
connect: DbConnect::Socket("/var/run/postgresql".into()),
ssl_options: SslOptions::Default,
options: IndexMap::default(),
},
&config.database,
);
@ -279,7 +280,7 @@ fn test_parse_postgres_socket_empty_hostname() {
username: "nextcloud".to_string(),
password: "redacted".to_string(),
connect: DbConnect::Socket("/run/postgresql".into()),
ssl_options: SslOptions::Default,
options: IndexMap::default(),
},
&config.database,
);
@ -309,7 +310,7 @@ fn test_parse_postgres_socket_no_pass() {
username: "redacted".to_string(),
password: "".to_string(),
connect: DbConnect::Socket("/var/run/postgresql".into()),
ssl_options: SslOptions::Default,
options: IndexMap::default(),
},
&config.database,
);
@ -337,7 +338,7 @@ fn test_parse_postgres_socket_folder() {
username: "redacted".to_string(),
password: "redacted".to_string(),
connect: DbConnect::Socket("/var/run/postgresql".into()),
ssl_options: SslOptions::Default,
options: IndexMap::default(),
},
&config.database,
);
@ -590,7 +591,9 @@ fn test_parse_postgres_ip() {
host: "1.2.3.4".to_string(),
port: 5432,
},
ssl_options: SslOptions::Disabled,
options: indexmap! {
"sslmode".into() => "disable".into()
},
},
&config.database,
);
@ -623,7 +626,7 @@ fn test_parse_postgres_fqdn() {
host: "pg.example.com".to_string(),
port: 5432,
},
ssl_options: SslOptions::Default,
options: IndexMap::default(),
},
&config.database,
);
@ -691,7 +694,9 @@ fn test_parse_postgres_escaped_credentials() {
host: "1.2.3.4".to_string(),
port: 5432,
},
ssl_options: SslOptions::Disabled,
options: indexmap! {
"sslmode".into() => "disable".into()
},
},
&config.database,
);