secretmanager

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2021 License: Apache-2.0 Imports: 7 Imported by: 3

README

secretmanager

Golang library for managing configuration data from Google Cloud's Secret Manager.

Usage

import "github.com/justindfuller/secretmanager"

var config struct {
  MySecret string `secretmanager:"MySecret"`
  AnotherSecret string `secretmanager:"AnotherSecret",version:"3"`
}

func main() {
  var c config
  if err := secretmanager.Parse(&c); err != nil {
    log.Fatal(err)
  }
  log.Print("Retrieved config from Google Secret Manager", c)
}

Defaults

  • version defaults to latest.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(c interface{}) error

Parse looks through a config (c) of type struct for any tag "secretmanager". It will use any struct property with this tag to generate a request to the GCP secretmanager API. It will populate the struct with the values returned by the secretmanager API. As a helpful default, it will use context.Background and os.Getenv("GOOGLE_CLOUD_PROJECT")

func ParseWithContext

func ParseWithContext(ctx context.Context, c interface{}) error

ParseWithContext is the same as Parse, except you can pass in a context.

func ParseWithContextAndProject

func ParseWithContextAndProject(ctx context.Context, project string, c interface{}) error

ParseWithContextAndProject is the same as Parse, except you can pass in context and project.

func ParseWithProject

func ParseWithProject(project string, c interface{}) error

ParseWithProject is the same as Parse, except you can pass in a project.

Types

This section is empty.

Jump to

Keyboard shortcuts

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