mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-06 16:02:23 +00:00
add PG_SCHEMA support
This commit is contained in:
@@ -59,6 +59,10 @@ impl Authable for Authed {
|
||||
}
|
||||
}
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref PG_SCHEMA: Option<String> = std::env::var("PG_SCHEMA").ok();
|
||||
}
|
||||
|
||||
impl UserDB {
|
||||
pub fn new(db: DB) -> Self {
|
||||
Self { db }
|
||||
@@ -95,6 +99,12 @@ impl UserDB {
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
|
||||
if let Some(schema) = PG_SCHEMA.as_ref() {
|
||||
sqlx::query(&format!("SET LOCAL search_path TO {}", schema))
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
}
|
||||
|
||||
sqlx::query!(
|
||||
"SELECT set_config('session.user', $1, true)",
|
||||
authed.username()
|
||||
|
||||
Reference in New Issue
Block a user