Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/connor4312/keyvault-loader
Helper to load keyvault values from a config, optionally caching them locally
https://github.com/connor4312/keyvault-loader
Last synced: about 1 month ago
JSON representation
Helper to load keyvault values from a config, optionally caching them locally
- Host: GitHub
- URL: https://github.com/connor4312/keyvault-loader
- Owner: connor4312
- License: mit
- Created: 2021-04-11T19:58:53.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-04-12T15:44:14.000Z (over 3 years ago)
- Last Synced: 2024-10-25T22:13:19.763Z (about 2 months ago)
- Language: TypeScript
- Size: 68.4 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# @c4312/keyvault-loader
Small utility library that:
- Replaces all keyvault secret URIs in the object with their value loaded from keyvault
- Can optionally cache secrets on disk. Very useful in a development environment, since otherwise loading secrets from keyvault can take several seconds.Secrets cached on disk are appropriately permissioned and AES encrypted, but bear in mind these will have less security than a keyvault value stored only in memory.
## Usage
```ts
import { AzureCliCredential } from '@azure/identity';
import { SecretClient } from '@azure/keyvault-secrets';
import resolveConfig from '@c4312/keyvault-loader';const myConfig = { fooSecret: 'https://myvault.vault.azure.net/secrets/foo' };}
const resolved = await resolveConfig(myConfig, {
client: keyvaultUrl => new SecretClient(keyvaultUrl, new AzureCliCredential()),
cache: true
});console.log(resolved); // { fooSecret: 'mySecretValue' }
```