wasmcloud_host/
workload_identity.rs1use anyhow::{Context as _, Result};
2
3const AUTH_SERVICE_AUDIENCE_ENV: &str = "WASMCLOUD_WORKLOAD_IDENTITY_AUTH_SERVICE_AUDIENCE";
5
6#[derive(Clone, Default, Debug)]
8pub struct WorkloadIdentityConfig {
9 pub auth_service_audience: String,
12}
13
14impl WorkloadIdentityConfig {
15 #[cfg(unix)]
17 pub fn from_env() -> Result<Self> {
18 let auth_service_audience = std::env::var(AUTH_SERVICE_AUDIENCE_ENV)
21 .context("workload identity auth callout audience environment variable is missing")?;
22
23 Ok(Self {
24 auth_service_audience,
25 })
26 }
27
28 #[cfg(target_family = "windows")]
29 pub fn from_env() -> Result<Self> {
30 anyhow::bail!("workload identity is not supported on Windows")
31 }
32}