Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/erikhoward/flask-keyvault
Flask extension to read and write secrets from Azure Key Vault
https://github.com/erikhoward/flask-keyvault
azure azure-key-vault azure-keyvault flask flask-extension
Last synced: 3 months ago
JSON representation
Flask extension to read and write secrets from Azure Key Vault
- Host: GitHub
- URL: https://github.com/erikhoward/flask-keyvault
- Owner: erikhoward
- License: mit
- Archived: true
- Created: 2019-03-05T21:14:50.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-05-01T20:32:54.000Z (over 1 year ago)
- Last Synced: 2024-05-16T16:48:55.038Z (6 months ago)
- Topics: azure, azure-key-vault, azure-keyvault, flask, flask-extension
- Language: Python
- Size: 8.79 KB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - erikhoward/flask-keyvault - Flask extension to read and write secrets from Azure Key Vault (Python)
README
# Flask-KeyVault
A Flask extension to read and write secrets using [Azure Key Vault](https://azure.microsoft.com/en-us/services/key-vault/).
## Installation
```bash
$ pip install Flask-KeyVault
```
## Usage
```python
import osfrom flask import Flask
from flask_keyvault import KeyVault
from flask_keyvault.exceptions import KeyVaultAuthenticationErrordemo = Flask(__name__)
demo.config.update(
AZURE_CLIENT_ID = os.getenv('AZURE_CLIENT_ID','YOUR-AZURE_CLIENT_ID'),
AZURE_SECRET = os.getenv('AZURE_SECRET', 'YOUR-AZURE-SECRET'),
AZURE_TENANT = os.getenv('AZURE_TENANT', 'YOUR-AZURE-TENANT')
)keyvault = KeyVault()
keyvault.init_app(demo)key_vault_url = 'https://mykeyvault.vault.azure.net/'
@demo.route('/')
def index():try:
my_secret = keyvault.get(key_vault_url, "my_secret", 1)
return my_secret
except KeyVaultAuthenticationError:
return "authentication error"demo.run(debug=True)
```## Contributing
Questions, comments or improvements, please create an issue on [Github](https://github.com/erikhoward/flask-keyvault/issues).To suggest a change to the code or documentation, please create a new pull request on GitHub. Also, please squash multiple commits into a single commit in your pull request by rebasing onto the master branch.
## License
Flask-KeyVault is licensed under the [MIT](LICENSE) license.## Contact
Home: [www.erikhoward.net](https://www.erikhoward.net)Twitter: [@erik_howard](https://www.twitter.com/erik_howard)