From c9649f9aacabc8733319f56c0d84943b92633636 Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Thu, 3 Oct 2024 09:08:56 -0600 Subject: [PATCH] Add pgdsn parameter --- edgedb-tokio/src/raw/connection.rs | 14 ++++++++++++++ edgedb-tokio/src/server_params.rs | 9 +++++++++ 2 files changed, 23 insertions(+) diff --git a/edgedb-tokio/src/raw/connection.rs b/edgedb-tokio/src/raw/connection.rs index e0d071e8..1eddfdd2 100644 --- a/edgedb-tokio/src/raw/connection.rs +++ b/edgedb-tokio/src/raw/connection.rs @@ -502,6 +502,20 @@ async fn connect4(cfg: &Config, mut stream: TlsStream) -> Result(pgaddr); } + #[cfg(feature = "unstable")] + b"pgdsn" => { + use crate::server_params::PostgresDsn; + + let pgdsn = match str::from_utf8(&par.value) { + Ok(a) => a.to_owned(), + Err(e) => { + log::warn!("Can't decode param {:?}: {}", par.name, e); + continue; + } + }; + + server_params.set::(PostgresDsn(pgdsn)); + } b"system_config" => { handle_system_config(par, &mut server_params)?; } diff --git a/edgedb-tokio/src/server_params.rs b/edgedb-tokio/src/server_params.rs index 3d9f5b42..90cc39dc 100644 --- a/edgedb-tokio/src/server_params.rs +++ b/edgedb-tokio/src/server_params.rs @@ -33,6 +33,15 @@ impl ServerParam for PostgresAddress { impl SealedParam for PostgresAddress {} +#[derive(Debug)] +pub struct PostgresDsn(pub String); + +impl ServerParam for PostgresDsn { + type Value = PostgresDsn; +} + +impl SealedParam for PostgresDsn {} + /// ParameterStatus_SystemConfig #[derive(Debug)] pub struct SystemConfig {