policyweaver.core.conf

policyweaver.core.conf

class policyweaver.core.conf.Configuration

Bases: object

Configuration class for managing application settings and environment variables. This class provides methods to set and retrieve configuration values, including correlation IDs and service principal credentials. Example usage:

config = Configuration() config.configure_environment(SourceMap(correlation_id=”12345”)) print(os.environ[‘CORRELATION_ID’]) # Outputs: 12345

static configure_environment(config: SourceMap)

Configure the environment with the provided SourceMap configuration. This method sets the correlation ID in the environment variables and ensures that a unique correlation ID is generated if not provided. Args:

config (SourceMap): The SourceMap instance containing configuration values.

static retrieve_key_vault_credentials(config: SourceMap)

Retrieve the Key Vault credentials from the configuration. This method checks if the Key Vault is enabled and retrieves the necessary credentials. Args:

config (SourceMap): The SourceMap instance containing configuration values.

Returns:

dict: A dictionary containing Key Vault credentials if available.