Blitz.Configuration.Vault.Library
6.1.0
dotnet add package Blitz.Configuration.Vault.Library --version 6.1.0
NuGet\Install-Package Blitz.Configuration.Vault.Library -Version 6.1.0
<PackageReference Include="Blitz.Configuration.Vault.Library" Version="6.1.0" />
paket add Blitz.Configuration.Vault.Library --version 6.1.0
#r "nuget: Blitz.Configuration.Vault.Library, 6.1.0"
// Install Blitz.Configuration.Vault.Library as a Cake Addin #addin nuget:?package=Blitz.Configuration.Vault.Library&version=6.1.0 // Install Blitz.Configuration.Vault.Library as a Cake Tool #tool nuget:?package=Blitz.Configuration.Vault.Library&version=6.1.0
VaultAsConfigDemo
Using Hashicorp Vault as a Configuration Store
Prerequisites
Install Docker: https://docs.docker.com/get-docker/
Install Vault Client: https://www.vaultproject.io/downloads
Start Docker
Run
./scripts/start_docker_vault.sh
(or PS1) to start Vault in Docker, which will tie up the command bash shellCheck to make sure it started ok
./scripts/vault-status.sh
(or PS1)Put some values into the Vault by running
./scripts/put-settings.sh
(or PS1) which puts the json file into the vault undermyApp/dev
using the filemyApp-dev-settings.json
Run the demo in Visual Studio or Code to see how it works
Stop Docker Vault
./scripts/start_docker_vault.sh
(or PS1)
Setting up a structure for key value pairs or json blobs
Decide on a folder structure, for the demo we're using a subpath of:
/{application}/{environment}
Under the RootPath of RootPath
, so in the Hasicorp Parlance, the Store is secret/${VAULT_APP}/${VAULT_ENV}
, which the API would need the path /v1/secret/data/${VAULT_APP}/${VAULT_ENV}
Decide on loose key/value pairs or a json datagram.
- For this demo we have selected json (as we think is is tidy).
Store the configuration using code or the vault cli
- See the example scripts
Logging into UI
Command Line
$ ./Blitz.Configuration.Vault.Demo --help
Blitz.Configuration.Vault.Demo 1.0.0 Copyright (C) 2020 Blitz.Configuration.Vault.Demo
Blitz.Configuration.Vault.Demo 1.0.0
Copyright (C) 2020-2023 Blitz.Configuration.Vault.Demo
USAGE:
From Environment Variables:
VaultDemo
Vary Environment:
VaultDemo --App myApp --Env dev --Token myroot
Full command line:
VaultDemo --App myApp --Dump --Env dev --Root Path v1/secret/data --Token
myroot --VaultUrl http://localhost:8200
-u, --VaultUrl Vault Url (env: 'vaulturl')
-t, --Token Vault Token (env: 'vaulttoken')
-a, --App Application Name (env: 'vaultapp')
-e, --Env Environment (env: 'vaultenv')
-d, --Dump Dump All Read Configuration
-r, --Root Path (Default: v1/secret/data) RootPath e.g. 'v1/secret/data'
(env: 'vaultrootpath')
--help Display this help screen.
--version Display version information.
Configuration Variables
These can be environment variables (ideally injected as part of CD pipeline)
variable | description | default |
---|---|---|
vaulturl | url to vault server | http://127.0.0.1:8200 |
vaulttoken | root token | myroot |
vaultapp | your applicaton name | myApp |
vaultenv | which environment are you running in | dev |
vaultrootpath | relative path to the root of your secrets | v1/secret/data |
Demo Data
- The script
scripts\put-settings.ps1
creates 3 key/value pairs using in thevaultapp
= myApp, for thevaultenv
of dev - The command line, and web demos use these values to get the configuration for themselves
-
- This will need to be refactored to your use case
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Microsoft.Extensions.Configuration (>= 7.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0.0)
- Microsoft.Extensions.Http (>= 7.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.0)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
6.1.0 | 213 | 4/23/2023 |
- 6.1.0 - Updated to Current Packages