From 6c809b86300cd4cb461556eb570620f70ca0e26d Mon Sep 17 00:00:00 2001 From: HugoCasa Date: Fri, 15 Dec 2023 15:15:55 +0100 Subject: [PATCH] fix: postgres ssl mode (#2861) --- backend/windmill-worker/src/pg_executor.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/windmill-worker/src/pg_executor.rs b/backend/windmill-worker/src/pg_executor.rs index 87a8b2fd03..ba71f5424c 100644 --- a/backend/windmill-worker/src/pg_executor.rs +++ b/backend/windmill-worker/src/pg_executor.rs @@ -67,7 +67,12 @@ pub async fn do_postgresql( } else { return Err(Error::BadRequest("Missing database argument".to_string())); }; - let sslmode = database.sslmode.unwrap_or("prefer".to_string()); + let sslmode = match database.sslmode.as_deref() { + Some("allow") => "prefer".to_string(), + Some("verify-ca") | Some("verify-full") => "require".to_string(), + Some(s) => s.to_string(), + None => "prefer".to_string(), + }; let database_string = format!( "postgres://{user}:{password}@{host}:{port}/{dbname}?sslmode={sslmode}", user = encode(&database.user.unwrap_or("postgres".to_string())),