use crate::provider::ProviderRegistry;
use anyhow::Result;
use std::sync::Arc;
use tokio::sync::OnceCell;
static PROVIDER_REGISTRY: OnceCell<Arc<ProviderRegistry>> = OnceCell::const_new();
pub(super) async fn get_registry() -> Result<Arc<ProviderRegistry>> {
PROVIDER_REGISTRY
.get_or_try_init(|| async { Ok(Arc::new(ProviderRegistry::from_vault().await?)) })
.await
.cloned()
}
#[cfg(test)]
pub(super) async fn set_registry_for_test(registry: Arc<ProviderRegistry>) {
let _ = PROVIDER_REGISTRY.set(registry);
}