mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-27 01:50:38 +00:00
add backward compatibility to proxy
This commit is contained in:
@@ -86,8 +86,17 @@ pub(super) async fn authenticate(
|
||||
.host(&db_info.host)
|
||||
.port(db_info.port)
|
||||
.dbname(&db_info.dbname)
|
||||
.user(&db_info.user)
|
||||
.ssl_mode(SslMode::Require); // we need TLS connection with SNI to properly route it
|
||||
.user(&db_info.user);
|
||||
|
||||
// Backwards compatibility. pg_sni_proxy uses "--" in domain names
|
||||
// while direct connections do not. Once we migrate to pg_sni_proxy
|
||||
// everywhere, we can remove this.
|
||||
if db_info.host.contains("--") {
|
||||
// we need TLS connection with SNI info to properly route it
|
||||
config.ssl_mode(SslMode::Require);
|
||||
} else {
|
||||
config.ssl_mode(SslMode::Disable);
|
||||
}
|
||||
|
||||
if let Some(password) = db_info.password {
|
||||
config.password(password.as_ref());
|
||||
|
||||
Reference in New Issue
Block a user