diff --git a/proxy/src/main.rs b/proxy/src/main.rs index 5b66f4b986..b4b58dc622 100644 --- a/proxy/src/main.rs +++ b/proxy/src/main.rs @@ -28,6 +28,9 @@ pub struct ProxyConf { /// will notify us here, so that we can 'unfreeze' user session. pub mgmt_address: SocketAddr, + /// send unauthenticated users to this URI + pub redirect_uri: String, + /// control plane address where we would check auth. pub cplane_address: SocketAddr, } @@ -55,11 +58,20 @@ fn main() -> anyhow::Result<()> { .help("listen for management callback connection on ip:port") .default_value("127.0.0.1:7000"), ) + .arg( + Arg::with_name("uri") + .short("u") + .long("uri") + .takes_value(true) + .help("redirect unauthenticated users to given uri") + .default_value("http://localhost:3000/psql_session/"), + ) .get_matches(); let conf = ProxyConf { proxy_address: arg_matches.value_of("proxy").unwrap().parse()?, mgmt_address: arg_matches.value_of("mgmt").unwrap().parse()?, + redirect_uri: arg_matches.value_of("uri").unwrap().parse()?, cplane_address: "127.0.0.1:3000".parse()?, }; let state = ProxyState { diff --git a/proxy/src/proxy.rs b/proxy/src/proxy.rs index 3b43382bb8..b4300d7ea8 100644 --- a/proxy/src/proxy.rs +++ b/proxy/src/proxy.rs @@ -184,12 +184,12 @@ impl ProxyConnection { To proceed with database creation open following link: - https://console.zenith.tech/psql_session/{} + {}{} It needed to be done once and we will send you '.pgpass' file which will allow you to access or create databases without opening the browser. -", self.psql_session_id); +", self.state.conf.redirect_uri,self.psql_session_id); self.pgb .write_message_noflush(&BeMessage::AuthenticationOk)?;