use azure_core::credentials::TokenCredential;
use std::sync::Arc;
use stratify::config::source::AzureAppConfigSource;
use stratify::config::Builder;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let endpoint = std::env::var("APP_CONFIG_ENDPOINT")
.map_err(|_| "set APP_CONFIG_ENDPOINT to your App Configuration store URL")?;
let credential = azure_identity::DeveloperToolsCredential::new(None)?;
let azure = AzureAppConfigSource::new(endpoint, credential as Arc<dyn TokenCredential>, 10)
.with_label("production");
let store = Builder::default()
.json("examples/config/base.json", 100)
.source(azure)
.build()
.await?;
println!("{}", serde_json::to_string_pretty(&store.full_config())?);
Ok(())
}