diff --git a/README.md b/README.md index d4d5cbb0ce..2e7edf2468 100644 --- a/README.md +++ b/README.md @@ -306,6 +306,7 @@ upcoming CLI tool. | SUPERADMIN_SECRET | None | A token that would let the caller act as a virtual superadmin superadmin@windmill.dev | Server | | TIMEOUT_WAIT_RESULT | 20 | The number of seconds to wait before timeout on the 'run_wait_result' endpoint | Worker | | QUEUE_LIMIT_WAIT_RESULT | None | The number of max jobs in the queue before rejecting immediately the request in 'run_wait_result' endpoint. Takes precedence on the query arg. If none is specified, there are no limit. | Worker | +| DENO_AUTH_TOKENS | None | Custom DENO_AUTH_TOKENS to pass to worker to allow the use of private modules | Worker | diff --git a/backend/windmill-worker/src/worker.rs b/backend/windmill-worker/src/worker.rs index 110d4140de..038c9bf6b9 100644 --- a/backend/windmill-worker/src/worker.rs +++ b/backend/windmill-worker/src/worker.rs @@ -414,6 +414,10 @@ pub async fn run_worker( let pip_index_url = std::env::var("PIP_INDEX_URL").ok(); let pip_extra_index_url = std::env::var("PIP_EXTRA_INDEX_URL").ok(); let pip_trusted_host = std::env::var("PIP_TRUSTED_HOST").ok(); + let deno_auth_tokens = std::env::var("DENO_AUTH_TOKENS") + .ok() + .map(|x| format!(";{x}")) + .unwrap_or_else(|| String::new()); let max_log_size = std::env::var("MAX_LOG_SIZE") .ok() .and_then(|x| x.parse::().ok()) @@ -436,6 +440,7 @@ pub async fn run_worker( pip_extra_index_url, pip_trusted_host, max_log_size, + deno_auth_tokens, }; WORKER_STARTED.inc(); @@ -735,6 +740,7 @@ struct Envs { pip_index_url: Option, pip_extra_index_url: Option, pip_trusted_host: Option, + deno_auth_tokens: String, max_log_size: i64, } @@ -1411,7 +1417,7 @@ fn capitalize(s: &str) -> String { #[tracing::instrument(level = "trace", skip_all)] async fn handle_deno_job( WorkerConfig { base_internal_url, base_url, disable_nuser, disable_nsjail, .. }: &WorkerConfig, - Envs { nsjail_path, deno_path, path_env, max_log_size, .. }: &Envs, + Envs { nsjail_path, deno_path, path_env, max_log_size, deno_auth_tokens, .. }: &Envs, logs: &mut String, job: &QueuedJob, db: &sqlx::Pool, @@ -1466,7 +1472,8 @@ run().catch(async (e) => {{ let hostname_base = base_url.split("://").last().unwrap_or("localhost"); let hostname_internal = base_internal_url.split("://").last().unwrap_or("localhost"); - let deno_auth_tokens = format!("{token}@{hostname_base};{token}@{hostname_internal}"); + let deno_auth_tokens = + format!("{token}@{hostname_base};{token}@{hostname_internal}{deno_auth_tokens}",); let child = async { Ok(if !disable_nsjail { let _ = write_file(