essentials-configuration-keyvault


Nameessentials-configuration-keyvault JSON
Version 1.0.1 PyPI version JSON
download
home_page
SummaryAzure Key Vault source for essentials-configuration.
upload_time2023-04-10 13:49:14
maintainer
docs_urlNone
author
requires_python>=3.7
license
keywords azure key vault configuration environment secrets
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![Build](https://github.com/Neoteroi/essentials-configuration-keyvault/workflows/Build/badge.svg)
[![pypi](https://img.shields.io/pypi/v/essentials-configuration-keyvault.svg)](https://pypi.python.org/pypi/essentials-configuration-keyvault)
[![versions](https://img.shields.io/pypi/pyversions/essentials-configuration-keyvault.svg)](https://github.com/Neoteroi/essentials-configuration-keyvault)
[![codecov](https://codecov.io/gh/Neoteroi/essentials-configuration-keyvault/branch/main/graph/badge.svg)](https://codecov.io/gh/Neoteroi/essentials-configuration-keyvault)
[![license](https://img.shields.io/github/license/Neoteroi/essentials-configuration-keyvault.svg)](https://github.com/Neoteroi/essentials-configuration-keyvault/blob/main/LICENSE)

# essentials-configuration-keyvault
[Azure Key
Vault](https://docs.microsoft.com/en-us/azure/key-vault/general/overview)
source for
[`essentials-configuration`](https://github.com/Neoteroi/essentials-configuration).

```bash
pip install essentials-configuration-keyvault
```

`essentials-configuration` provides a way to handle configuration roots
composed of different layers, such as configuration files and environmental
variables. Layers are applied in order and can override each others' values,
enabling different scenarios like configuration by environment (e.g. DEV, TEST,
PROD) and system instance.

`essentials-configuration-keyvault` provides a solution to add secrets stored
in Azure Key Vault into configuration objects.

Example:

```python
from azure.identity import DefaultAzureCredential
from azure.keyvault.secrets import SecretClient
from config.common import ConfigurationBuilder
from config.keyvault import KeyVaultSource

key_vault_name = "example-keyvault-name"

secrets_client = SecretClient(
    vault_url=f"https://{key_vault_name}.vault.azure.net",
    credential=DefaultAzureCredential(),
)

builder = ConfigurationBuilder(KeyVaultSource(secrets_client))

# when the configuration object is built, secrets are fetched from
# the linked key vault and put into the configuration object (e.g.
# database connection strings, API keys for SendGrid, etc.)
config = builder.build()
```

> Refer to the [official Key Vault documentation for more
> information about its Python client library.](https://docs.microsoft.com/en-us/azure/key-vault/secrets/quick-create-python).

## How to run the tests using a real Key Vault

The provided tests can either use a mocked `SecretClient`, or use a real Key Vault.
To use a real Key Vault service:

1. create a Key Vault ([ref.](https://docs.microsoft.com/en-us/azure/key-vault/secrets/quick-create-python))
2. sign-in using any way supported by `azure.identity.DefaultAzureCredential` 3
   (e.g. VS Code or `az login`)
3. run the tests with the following command:

```bash
KEYVAULT_NAME="<YOUR_KEYVAULT_NAME>" pytest -s
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "essentials-configuration-keyvault",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "Azure Key Vault,configuration,environment,secrets",
    "author": "",
    "author_email": "Roberto Prevato <roberto.prevato@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/13/a1/c2d8f12a3013453f1c9c8be9de52cd0656858f6f119b72f0dc74ba504cc0/essentials_configuration_keyvault-1.0.1.tar.gz",
    "platform": null,
    "description": "![Build](https://github.com/Neoteroi/essentials-configuration-keyvault/workflows/Build/badge.svg)\n[![pypi](https://img.shields.io/pypi/v/essentials-configuration-keyvault.svg)](https://pypi.python.org/pypi/essentials-configuration-keyvault)\n[![versions](https://img.shields.io/pypi/pyversions/essentials-configuration-keyvault.svg)](https://github.com/Neoteroi/essentials-configuration-keyvault)\n[![codecov](https://codecov.io/gh/Neoteroi/essentials-configuration-keyvault/branch/main/graph/badge.svg)](https://codecov.io/gh/Neoteroi/essentials-configuration-keyvault)\n[![license](https://img.shields.io/github/license/Neoteroi/essentials-configuration-keyvault.svg)](https://github.com/Neoteroi/essentials-configuration-keyvault/blob/main/LICENSE)\n\n# essentials-configuration-keyvault\n[Azure Key\nVault](https://docs.microsoft.com/en-us/azure/key-vault/general/overview)\nsource for\n[`essentials-configuration`](https://github.com/Neoteroi/essentials-configuration).\n\n```bash\npip install essentials-configuration-keyvault\n```\n\n`essentials-configuration` provides a way to handle configuration roots\ncomposed of different layers, such as configuration files and environmental\nvariables. Layers are applied in order and can override each others' values,\nenabling different scenarios like configuration by environment (e.g. DEV, TEST,\nPROD) and system instance.\n\n`essentials-configuration-keyvault` provides a solution to add secrets stored\nin Azure Key Vault into configuration objects.\n\nExample:\n\n```python\nfrom azure.identity import DefaultAzureCredential\nfrom azure.keyvault.secrets import SecretClient\nfrom config.common import ConfigurationBuilder\nfrom config.keyvault import KeyVaultSource\n\nkey_vault_name = \"example-keyvault-name\"\n\nsecrets_client = SecretClient(\n    vault_url=f\"https://{key_vault_name}.vault.azure.net\",\n    credential=DefaultAzureCredential(),\n)\n\nbuilder = ConfigurationBuilder(KeyVaultSource(secrets_client))\n\n# when the configuration object is built, secrets are fetched from\n# the linked key vault and put into the configuration object (e.g.\n# database connection strings, API keys for SendGrid, etc.)\nconfig = builder.build()\n```\n\n> Refer to the [official Key Vault documentation for more\n> information about its Python client library.](https://docs.microsoft.com/en-us/azure/key-vault/secrets/quick-create-python).\n\n## How to run the tests using a real Key Vault\n\nThe provided tests can either use a mocked `SecretClient`, or use a real Key Vault.\nTo use a real Key Vault service:\n\n1. create a Key Vault ([ref.](https://docs.microsoft.com/en-us/azure/key-vault/secrets/quick-create-python))\n2. sign-in using any way supported by `azure.identity.DefaultAzureCredential` 3\n   (e.g. VS Code or `az login`)\n3. run the tests with the following command:\n\n```bash\nKEYVAULT_NAME=\"<YOUR_KEYVAULT_NAME>\" pytest -s\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Azure Key Vault source for essentials-configuration.",
    "version": "1.0.1",
    "split_keywords": [
        "azure key vault",
        "configuration",
        "environment",
        "secrets"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3c91bfdc5a952ab7731afa0876f7932ed0588a13f4c19680fe292d8a02f069c3",
                "md5": "c07cf40630542a629603d206c9729cb6",
                "sha256": "6e355b324d80a20d46cd165b4e31a1f14513e529217cd8d2516459bef736a1c9"
            },
            "downloads": -1,
            "filename": "essentials_configuration_keyvault-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c07cf40630542a629603d206c9729cb6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 3942,
            "upload_time": "2023-04-10T13:49:13",
            "upload_time_iso_8601": "2023-04-10T13:49:13.126376Z",
            "url": "https://files.pythonhosted.org/packages/3c/91/bfdc5a952ab7731afa0876f7932ed0588a13f4c19680fe292d8a02f069c3/essentials_configuration_keyvault-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "13a1c2d8f12a3013453f1c9c8be9de52cd0656858f6f119b72f0dc74ba504cc0",
                "md5": "05ad87e2268ce9400f92f7e4a5704f82",
                "sha256": "e7d06539ab5d070afca21cd42a7b13ea525a899f1ca189cf516d6826b5f504c9"
            },
            "downloads": -1,
            "filename": "essentials_configuration_keyvault-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "05ad87e2268ce9400f92f7e4a5704f82",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 3661,
            "upload_time": "2023-04-10T13:49:14",
            "upload_time_iso_8601": "2023-04-10T13:49:14.146858Z",
            "url": "https://files.pythonhosted.org/packages/13/a1/c2d8f12a3013453f1c9c8be9de52cd0656858f6f119b72f0dc74ba504cc0/essentials_configuration_keyvault-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-10 13:49:14",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "essentials-configuration-keyvault"
}
        
Elapsed time: 0.05527s