ExAzureCore.Config (ex_azure_core v0.2.0)

Copy Markdown

Configuration management for ExAzureCore.

Builds configuration by merging from multiple sources (lowest to highest priority):

  1. Service defaults from ExAzureCore.Config.Defaults
  2. Global config from config :ex_azure_core
  3. Service-specific config from config :ex_azure_core, :service_name
  4. Per-request overrides from ExAzureCore.request(op, overrides)

Application Configuration

# config/config.exs

# Global defaults (apply to all services)
config :ex_azure_core,
  timeout: 30_000,
  max_retries: 3

# Service-specific configuration
config :ex_azure_core, :storage,
  account: {:system, "AZURE_STORAGE_ACCOUNT"},
  credential: my_named_key_credential

config :ex_azure_core, :keyvault,
  vault_name: "my-vault",
  credential: :azure_default_credential  # TokenServer name

Runtime Value Resolution

Values can be resolved at runtime using {:system, "ENV_VAR"} tuples:

config :ex_azure_core, :storage,
  account: {:system, "AZURE_STORAGE_ACCOUNT"},
  credential: {:system, "AZURE_STORAGE_KEY"}

Credential Types

The :credential config accepts:

  • AzureKeyCredential struct - Uses ApiKey plugin
  • AzureSasCredential struct - Uses SasToken plugin
  • AzureNamedKeyCredential struct - Uses SharedKey plugin
  • Atom (e.g., :my_credential) - Uses BearerToken plugin with TokenServer

Summary

Functions

Builds complete configuration for a service operation.

Functions

new(service, overrides \\ [])

@spec new(
  atom(),
  keyword()
) :: map()

Builds complete configuration for a service operation.

Examples

# With defaults only
config = ExAzureCore.Config.new(:keyvault)

# With per-request overrides
config = ExAzureCore.Config.new(:storage, account: "other-account")