providers

package
v0.377.3 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const ASMProviderKey configuration.ProviderKey = "asm"
View Source
const DatabaseConfigProviderKey configuration.ProviderKey = "db"
View Source
const EnvarProviderKey configuration.ProviderKey = "envar"
View Source
const InlineProviderKey configuration.ProviderKey = "inline"
View Source
const KeychainProviderKey configuration.ProviderKey = "keychain"
View Source
const OnePasswordProviderKey configuration.ProviderKey = "op"

Variables

This section is empty.

Functions

This section is empty.

Types

type ASM

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

ASM implements a Provider for AWS Secrets Manager (ASM). Only supports loading "string" secrets, not binary secrets.

One controller is elected as the leader and is responsible for syncing the cache of secrets from ASM (see asmLeader). Others get secrets from the leader via AdminService (see asmFollower).

func NewASM

func NewASM(ctx context.Context, secretsClient *secretsmanager.Client, advertise *url.URL, leaser leases.Leaser) *ASM

func (*ASM) Delete

func (a *ASM) Delete(ctx context.Context, ref configuration.Ref) error

func (*ASM) Key

func (*ASM) Key() configuration.ProviderKey

func (ASM) Role

func (ASM) Role() configuration.Secrets

func (*ASM) Store

func (a *ASM) Store(ctx context.Context, ref configuration.Ref, value []byte) (*url.URL, error)

Store and if the secret already exists, update it.

func (*ASM) Sync

func (a *ASM) Sync(ctx context.Context, entries []configuration.Entry, values *xsync.MapOf[configuration.Ref, configuration.SyncedValue]) error

func (*ASM) SyncInterval

func (a *ASM) SyncInterval() time.Duration

type DatabaseConfig

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

DatabaseConfig is a configuration provider that stores configuration in its key.

func NewDatabaseConfig

func NewDatabaseConfig(dal DatabaseConfigDAL) DatabaseConfig

func (DatabaseConfig) Delete

func (d DatabaseConfig) Delete(ctx context.Context, ref configuration.Ref) error

func (DatabaseConfig) Key

func (DatabaseConfig) Load

func (d DatabaseConfig) Load(ctx context.Context, ref configuration.Ref, key *url.URL) ([]byte, error)

func (DatabaseConfig) Role

func (DatabaseConfig) Store

func (d DatabaseConfig) Store(ctx context.Context, ref configuration.Ref, value []byte) (*url.URL, error)

type DatabaseConfigDAL

type DatabaseConfigDAL interface {
	GetModuleConfiguration(ctx context.Context, module optional.Option[string], name string) ([]byte, error)
	SetModuleConfiguration(ctx context.Context, module optional.Option[string], name string, value []byte) error
	UnsetModuleConfiguration(ctx context.Context, module optional.Option[string], name string) error
}

type Envar

type Envar[R configuration.Role] struct{}

Envar is a configuration provider that reads secrets or configuration from environment variables.

func NewEnvar

func NewEnvar[R configuration.Role]() Envar[R]

func (Envar[R]) Delete

func (e Envar[R]) Delete(ctx context.Context, ref configuration.Ref) error

func (Envar[R]) Key

func (Envar[R]) Key() configuration.ProviderKey

func (Envar[R]) Load

func (e Envar[R]) Load(ctx context.Context, ref configuration.Ref, key *url.URL) ([]byte, error)

func (Envar[R]) Role

func (Envar[R]) Role() R

func (Envar[R]) Store

func (e Envar[R]) Store(ctx context.Context, ref configuration.Ref, value []byte) (*url.URL, error)

type Factory

type Factory[R configuration.Role] func(ctx context.Context) (configuration.Provider[R], error)

func NewASMFactory

func NewASMFactory(secretsClient *secretsmanager.Client, advertise *url.URL, leaser leases.Leaser) (configuration.ProviderKey, Factory[configuration.Secrets])

func NewEnvarFactory

func NewEnvarFactory[R configuration.Role]() (configuration.ProviderKey, Factory[R])

func NewInlineFactory

func NewInlineFactory[R configuration.Role]() (configuration.ProviderKey, Factory[R])

func NewOnePasswordFactory

func NewOnePasswordFactory(vault string, projectName string) (configuration.ProviderKey, Factory[configuration.Secrets])

type Inline

type Inline[R configuration.Role] struct{}

Inline is a configuration provider that stores configuration in its key.

func NewInline

func NewInline[R configuration.Role]() Inline[R]

func (Inline[R]) Delete

func (Inline[R]) Delete(ctx context.Context, ref configuration.Ref) error

func (Inline[R]) Key

func (Inline[R]) Key() configuration.ProviderKey

func (Inline[R]) Load

func (Inline[R]) Load(ctx context.Context, ref configuration.Ref, key *url.URL) ([]byte, error)

func (Inline[R]) Role

func (Inline[R]) Role() R

func (Inline[R]) Store

func (Inline[R]) Store(ctx context.Context, ref configuration.Ref, value []byte) (*url.URL, error)

type Keychain

type Keychain struct{}

func NewKeychain

func NewKeychain() Keychain

func (Keychain) Delete

func (k Keychain) Delete(ctx context.Context, ref configuration.Ref) error

func (Keychain) Key

func (Keychain) Load

func (k Keychain) Load(ctx context.Context, ref configuration.Ref, key *url.URL) ([]byte, error)

func (Keychain) Role

func (Keychain) Store

func (k Keychain) Store(ctx context.Context, ref configuration.Ref, value []byte) (*url.URL, error)

type OnePassword

type OnePassword struct {
	Vault       string
	ProjectName string
}

OnePassword is a configuration provider that reads passwords from 1Password vaults via the "op" command line tool.

func NewOnePassword

func NewOnePassword(vault string, projectName string) OnePassword

func (OnePassword) Delete

func (o OnePassword) Delete(ctx context.Context, ref configuration.Ref) error

func (OnePassword) Key

func (OnePassword) Role

func (OnePassword) Store

func (o OnePassword) Store(ctx context.Context, ref configuration.Ref, value []byte) (*url.URL, error)

Store will save the given secret in 1Password via the `op` command.

op does not support "create or update" as a single command. Neither does it support specifying an ID on create. Because of this, we need check if the item exists before creating it, and update it if it does.

func (OnePassword) Sync

func (o OnePassword) Sync(ctx context.Context, entries []configuration.Entry, values *xsync.MapOf[configuration.Ref, configuration.SyncedValue]) error

Sync will fetch all secrets from the 1Password vault and store them in the values map. Do not just sync the o.Vault, instead find all vaults found in entries and sync them.

func (OnePassword) SyncInterval

func (o OnePassword) SyncInterval() time.Duration

type Registry

type Registry[R configuration.Role] struct {
	// contains filtered or unexported fields
}

Registry that lazily constructs configuration providers.

func NewRegistry

func NewRegistry[R configuration.Role]() *Registry[R]

func (*Registry[R]) Get

func (*Registry[R]) Register

func (r *Registry[R]) Register(name configuration.ProviderKey, factory Factory[R])

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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