mirror of
https://codeberg.org/icewind/nextcloud-config-parser.git
synced 2026-06-03 08:34:13 +02:00
fix ipv6 database host
This commit is contained in:
parent
f694ccb408
commit
70543db580
3 changed files with 54 additions and 9 deletions
|
|
@ -721,3 +721,35 @@ fn test_parse_postgres_escaped_credentials() {
|
|||
PgConnectOptions::from_str(&config.database.url()).unwrap(),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_ipv6_db() {
|
||||
let config = config_from_file("tests/configs/ipv6_db.php");
|
||||
assert_debug_equal(
|
||||
&Database::MySql {
|
||||
database: "nextcloud".to_string(),
|
||||
username: "nextcloud".to_string(),
|
||||
password: "secret".to_string(),
|
||||
connect: DbConnect::Tcp {
|
||||
host: "[::1]".to_string(),
|
||||
port: 123,
|
||||
},
|
||||
ssl_options: SslOptions::Default,
|
||||
},
|
||||
&config.database,
|
||||
);
|
||||
assert_eq!(
|
||||
config.database.url(),
|
||||
"mysql://nextcloud:secret@[::1]:123/nextcloud"
|
||||
);
|
||||
|
||||
assert_debug_equal(
|
||||
MySqlConnectOptions::new()
|
||||
.host("[::1]")
|
||||
.username("nextcloud")
|
||||
.password("secret")
|
||||
.port(123)
|
||||
.database("nextcloud"),
|
||||
MySqlConnectOptions::from_str(&config.database.url()).unwrap(),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
15
tests/configs/ipv6_db.php
Normal file
15
tests/configs/ipv6_db.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
$CONFIG = [
|
||||
'overwrite.cli.url' => 'https://cloud.example.com',
|
||||
'dbtype' => 'mysql',
|
||||
'dbname' => 'nextcloud',
|
||||
'dbhost' => '[::1]:123',
|
||||
'dbport' => '',
|
||||
'dbtableprefix' => 'oc_',
|
||||
'dbuser' => 'nextcloud',
|
||||
'dbpassword' => 'secret',
|
||||
'redis' => [
|
||||
'host' => 'localhost'
|
||||
]
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue