mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-24 08:01:38 +00:00
5b3913052e
* refactor: extract load helpers from reload_setting family Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * refactor: convert atomic primitive globals to AtomicBool/AtomicI64 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * refactor: convert CRITICAL_*/HUB_API_SECRET/INSTANCE_EVENTS_WEBHOOK/JWT_SECRET to ArcSwap Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: pin ee-repo-ref to arcswap-refactor EE branch commit * refactor: convert BASE_URL/HUB_BASE_URL/MIN_VERSION/LICENSE_KEY*/LICENSE_KEY_ID to ArcSwap Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * refactor: convert worker hot-path globals to ArcSwap (WORKER_CONFIG et al) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: pin ee-repo-ref to combined arcswap-urls+worker EE commit * chore: update ee-repo-ref to d8be8f88cb8898c8f6b27421989d53528223815d This commit updates the EE repository reference after PR #532 was merged in windmill-ee-private. Previous ee-repo-ref: c375aaaac9ec0fc0480993627d0defc8054c31a4 New ee-repo-ref: d8be8f88cb8898c8f6b27421989d53528223815d Automated by sync-ee-ref workflow. * fix: cleanup unused imports + fix 2 missed WORKER_CONFIG readers Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: update ee-repo-ref to ce0f8fbbbde09c4a858312d2d8716d224e99042c This commit updates the EE repository reference after PR #534 was merged in windmill-ee-private. Previous ee-repo-ref: 450b601b5aba0ca0b2045f4b5071aa8701b4bfb7 New ee-repo-ref: ce0f8fbbbde09c4a858312d2d8716d224e99042c Automated by sync-ee-ref workflow. * fix: secret_backend_integration test — BASE_URL.write().await → .store() Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * refactor: convert APP_WORKSPACED_ROUTE to AtomicBool for symmetry with HTTP_ROUTE_WORKSPACED_ROUTE Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: update ee-repo-ref to e587df8 (post-#535 merge) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: windmill-internal-app[bot] <windmill-internal-app[bot]@users.noreply.github.com>
81 lines
2.6 KiB
Rust
81 lines
2.6 KiB
Rust
/*
|
|
* Author: Ruben Fiszel
|
|
* Copyright: Windmill Labs, Inc 2022
|
|
* This file and its contents are licensed under the AGPLv3 License.
|
|
* Please see the included NOTICE for copyright information and
|
|
* LICENSE-AGPL for a copy of the license.
|
|
*/
|
|
|
|
use std::sync::atomic::AtomicBool;
|
|
|
|
use serde_json::{from_value, Value};
|
|
|
|
use crate::{error, scripts::ScriptLang};
|
|
|
|
pub use windmill_types::apps::*;
|
|
|
|
lazy_static::lazy_static! {
|
|
pub static ref APP_WORKSPACED_ROUTE: AtomicBool = AtomicBool::new(false);
|
|
}
|
|
|
|
/// Traverse FlowValue while invoking provided by caller callback on leafs
|
|
// #[async_recursion::async_recursion(?Send)]
|
|
pub fn traverse_app_inline_scripts<
|
|
C: FnMut(AppInlineScript, Option<String>) -> error::Result<()>,
|
|
>(
|
|
value: &Value,
|
|
// Set to None.
|
|
container_id: Option<String>,
|
|
cb: &mut C,
|
|
) -> error::Result<()> {
|
|
match value {
|
|
Value::Object(object) => {
|
|
if let Some(Value::Object(script)) = object.get("inlineScript") {
|
|
let (language, lock, code) = (
|
|
script
|
|
.get("language")
|
|
.cloned()
|
|
.map(|v| from_value::<ScriptLang>(v).ok())
|
|
.flatten(),
|
|
script
|
|
.get("lock")
|
|
.and_then(Value::as_str)
|
|
.map(str::to_owned),
|
|
script
|
|
.get("content")
|
|
.and_then(Value::as_str)
|
|
.map(str::to_owned)
|
|
.ok_or(error::Error::internal_err(
|
|
"Missing `content` in inlineScript".to_string(),
|
|
))?,
|
|
);
|
|
if language.is_some() {
|
|
cb(
|
|
AppInlineScript { language, content: code.to_owned(), lock },
|
|
container_id.clone(),
|
|
)?;
|
|
}
|
|
} else {
|
|
for (_, value) in object {
|
|
traverse_app_inline_scripts(
|
|
value,
|
|
object
|
|
.get("id")
|
|
.and_then(Value::as_str)
|
|
.map(str::to_owned)
|
|
.or(container_id.clone()),
|
|
cb,
|
|
)?;
|
|
}
|
|
}
|
|
}
|
|
Value::Array(array) => {
|
|
for value in array {
|
|
traverse_app_inline_scripts(value, container_id.clone(), cb)?;
|
|
}
|
|
}
|
|
_ => {}
|
|
}
|
|
Ok(())
|
|
}
|