gcpsecretfetch

package module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2021 License: MIT Imports: 11 Imported by: 0

README

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

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.

v := viper.New()

type config struct {
		MY_SECRET_NAME string
	}

var cfg config

err := InitializeConfig(&cfg, "my-gcp-project", WithViper(v))

Documentation

Overview

Package gcpsecretfetch is a utility library for getting secrets from GCP Secret Manager.

Package gcpsecretfetch is a utility library for getting secrets from GCP Secret Manager.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitializeConfig

func InitializeConfig(cfg interface{}, project string, opts ...ConfigOption) error

InitializeConfig initializes a config struct by getting the secrets from GCP Secret Manager

This function works by reflecting on the fields in the passed pointer struct, and then dispatching calls to get the secret payloads from GCP for the corresponding secrets. The function must be passed a pointer to an arbitrary config struct, and the config struct must only have string fields.

func UpdateSecrets

func UpdateSecrets(project string, secrets map[string]string, opts ...ConfigOption) error

Types

type ConfigOption

type ConfigOption func(client *secretClient)

func WithConcurrency

func WithConcurrency(n int) ConfigOption

func WithDisablePrior added in v1.0.1

func WithDisablePrior() ConfigOption

func WithViper

func WithViper(v *viper.Viper) ConfigOption

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL