-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mads Schou-Andreasen
committed
Sep 9, 2021
1 parent
446c59f
commit 290de99
Showing
1 changed file
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,30 @@ | ||
# gcp-secret-fetch | ||
# gcpsecretfetch | ||
|
||
Utility library for getting secrets from GCP Secret Manager. | ||
The library works by accepting a pointer to a cfg struct that contains only string values, and then it populates the struct values with values from GCP for the corresponding secrets. | ||
|
||
## Example | ||
|
||
```go | ||
type config struct { | ||
MY_SECRET_NAME string | ||
} | ||
|
||
var cfg config | ||
|
||
err := InitializeConfig(&cfg, "my-gcp-project") | ||
``` | ||
|
||
## Viper support | ||
The library also supports setting the values of the config struct directly in a `viper.Viper` instance. | ||
```go | ||
v := viper.New() | ||
|
||
type config struct { | ||
MY_SECRET_NAME string | ||
} | ||
|
||
var cfg config | ||
|
||
err := InitializeConfig(&cfg, "my-gcp-project", WithViper(v)) | ||
``` |