You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+38-37Lines changed: 38 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,66 +82,67 @@ The token is made up of 3 parts:
82
82
83
83
If contents of the `AWSSECRETS#/appxyz/service1-password` are a string then `service1-password` will be the key and converted to UPPERCASE e.g. `SERVICE1_PASSWORD=som3V4lue`
84
84
85
+
### Special AZKVSECRETS
85
86
87
+
For Azure KeyVault the first part of the token needs to be the name of the vault.
88
+
89
+
> Azure Go SDK (v2) requires the vault Uri on initializing the client
90
+
91
+
`AZKVSECRET#/test-vault//token/1` ==> will use KeyVault implementation to retrieve the `/token/1` from a `test-vault`.
92
+
93
+
`AZKVSECRET#/test-vault/no-slash-token-1` ==> will use KeyVault implementation to retrieve the `no-slash-token-1` from a `test-vault`.
86
94
87
95
## Go API
88
96
97
+
latest api [here](https://pkg.go.dev/github.com/dnitsch/configmanager)
98
+
89
99
### Sample Use case
90
100
91
101
One of the sample use cases includes implementation in a K8s controller.
92
102
93
103
E.g. your Custom CRD stores some values in plain text that should really be secrets/nonpublic config parameters - something like this can be invoked from inside the controller code using the generator pkg API.
94
104
95
-
```go
96
-
funcreplaceTokens(instring, t *v1alpha.CustomFooCrdSpec) error {
97
-
98
-
tokens:= []string{}
105
+
See [examples](./examples/examples.go) for more examples and tests for sample input/usage
retrieveFromStrInput.PersistentFlags().StringVarP(&input, "input", "i", "", "Contents of a string inside a variable to be searched for tokens. e.g. -i $(cat /som/file)")
retrieveFromStrInput.PersistentFlags().StringVarP(&path, "path", "p", "./app.env", "Path where to write out the replaced a config/secret variables. Special value of stdout can be used to return the output to stdout e.g. -p stdout, unix style output only")
Copy file name to clipboardExpand all lines: cmd/configmanager/retrieve.go
+5-10Lines changed: 5 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@ package cmd
3
3
import (
4
4
"fmt"
5
5
6
+
"github.com/dnitsch/configmanager/cmd/utils"
6
7
"github.com/dnitsch/configmanager/pkg/generator"
7
8
"github.com/spf13/cobra"
8
9
)
@@ -11,10 +12,9 @@ import (
11
12
vartokenArray []string
12
13
13
14
var (
14
-
tokens []string
15
-
pathstring
16
-
tokenSeparatorstring
17
-
retrieveCmd=&cobra.Command{
15
+
tokens []string
16
+
pathstring
17
+
retrieveCmd=&cobra.Command{
18
18
Use: "retrieve",
19
19
Aliases: []string{"r", "fetch", "get"},
20
20
Short: `Retrieves a value for token(s) specified`,
@@ -33,16 +33,11 @@ func init() {
33
33
retrieveCmd.PersistentFlags().StringArrayVarP(&tokens, "token", "t", tokenArray, "Token pointing to a config/secret variable. This can be specified multiple times.")
34
34
retrieveCmd.MarkPersistentFlagRequired("token")
35
35
retrieveCmd.PersistentFlags().StringVarP(&path, "path", "p", "./app.env", "Path where to write out the replaced a config/secret variables. Special value of stdout can be used to return the output to stdout e.g. -p stdout, unix style output only")
36
-
retrieveCmd.PersistentFlags().StringVarP(&tokenSeparator, "token-separator", "s", "#", "Separator to use to mark concrete store and the key within it")
configmanagerCmd.PersistentFlags().StringVarP(&tokenSeparator, "token-separator", "s", "#", "Separator to use to mark concrete store and the key within it")
34
+
configmanagerCmd.PersistentFlags().StringVarP(&keySeparator, "key-separator", "k", "|", "Separator to use to mark a key look up in a map. e.g. AWSSECRETS#/token/map|key1")
0 commit comments