diff --git a/backend/windmill-api/src/workspaces.rs b/backend/windmill-api/src/workspaces.rs index 217d48dc7d..9fbba5cc48 100644 --- a/backend/windmill-api/src/workspaces.rs +++ b/backend/windmill-api/src/workspaces.rs @@ -2345,6 +2345,13 @@ lazy_static::lazy_static! { } }; + pub static ref DISABLE_WORKSPACE_FORK: bool = { + match std::env::var("DISABLE_WORKSPACE_FORK") { + Ok(val) => val == "true", + Err(_) => false, + } + }; + } async fn create_workspace_require_superadmin() -> String { @@ -3059,6 +3066,10 @@ async fn create_workspace_fork_branch( ))); } + if *DISABLE_WORKSPACE_FORK { + require_super_admin(&db, &authed.email).await?; + } + Ok(Json( handle_fork_branch_creation(&authed.email, &authed.username, &db, &w_id, &nw.id).await?, )) @@ -3076,6 +3087,10 @@ async fn create_workspace_fork( ))); } + if *DISABLE_WORKSPACE_FORK { + require_super_admin(&db, &authed.email).await?; + } + let mut tx: Transaction<'_, Postgres> = db.begin().await?; // Generate unique forked workspace ID with wm-fork prefix