secretmanager

package module
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package secretmanager loads configuration from GCP Secret Manager.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option = option.ClientOption

func WithFilter

func WithFilter(filter string) Option

WithFilter provides [filter] that will be used to select a set of secrets.

[filter]: // https://cloud.google.com/secret-manager/docs/filtering

func WithNameSplitter

func WithNameSplitter(splitter func(string) []string) Option

WithNameSplitter provides the function used to split secret names into nested keys. If it returns an nil/[]string{}/[]string{""}, the secret will be ignored.

For example, with the default splitter, an secret name like "PARENT-CHILD-KEY" would be split into "PARENT", "CHILD", and "KEY".

func WithPollInterval

func WithPollInterval(interval time.Duration) Option

WithPollInterval provides the interval for polling the configuration.

The default interval is 1 minute.

func WithProject

func WithProject(project string) Option

WithProject provides GCP project ID.

By default, it fetches project ID from metadata server.

type SecretManager

type SecretManager struct {
	// contains filtered or unexported fields
}

SecretManager is a Provider that loads configuration from GCP Secret Manager.

To create a new SecretManager, call New.

func New

func New(opts ...Option) *SecretManager

New creates a SecretManager with the given endpoint and Option(s).

func (*SecretManager) Load

func (m *SecretManager) Load() (map[string]any, error)

func (*SecretManager) Status added in v0.8.0

func (m *SecretManager) Status(onStatus func(bool, error))

func (*SecretManager) String

func (m *SecretManager) String() string

func (*SecretManager) Watch

func (m *SecretManager) Watch(ctx context.Context, onChange func(map[string]any)) error

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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