Skip to content

secrets

A wrapper for a keyvault to integrate with the Dagster EnvVar class for secure secret usage in dagster.

get_secret(env_var_name)

A wrapper for a keyvault to integrate with the Dagster EnvVar class.

Returns a secret from the keyvault and set it to an environment variable that can be used securely with dagster's EnvVar class.

Source code in data_platform_utils/secrets.py
def get_secret(env_var_name: str) -> dg.EnvVar:
    """A wrapper for a keyvault to integrate with the Dagster EnvVar class.

    Returns a secret from the keyvault and set it to an environment variable that can be
    used securely with dagster's EnvVar class.
    """
    secret = keyvault.get_secret(env_var_name)
    os.environ[env_var_name] = secret
    return dg.EnvVar(env_var_name)

get_secret_value(env_var_name)

A wrapper for a keyvault to integrate with the Dagster EnvVar class.

Returns a secret from the keyvault and set it to an environment variable that can be used securely with dagster's EnvVar class.

Source code in data_platform_utils/secrets.py
def get_secret_value(env_var_name: str) -> str:
    """A wrapper for a keyvault to integrate with the Dagster EnvVar class.

    Returns a secret from the keyvault and set it to an environment variable that can be
    used securely with dagster's EnvVar class.
    """
    return keyvault.get_secret(env_var_name)