stdawssecretsfx

package
v0.0.74 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package stdawssecretsfx provides access to secrets in the AWS Secret manager.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(p Params) (*secretcache.Cache, error)

func Provide

func Provide() fx.Option

func ProvideJSONSecret

func ProvideJSONSecret[S any, IDR SecretIDer]() fx.Option

ProvideJSONSecret provides a JSON secret with shape "S". It also requires a type that needs to be provided through fx as a dependency and implements SecretIDer. Usually this is a configuration struct that has the name of the ID as one of its fields, of which the field is loaded from an environment variable. This config then only needs to implement the SecretIDer interface by just returing the env value.

Types

type Config

type Config struct{}

type JSONSecret

type JSONSecret[S any] struct {
	// contains filtered or unexported fields
}

JSONSecret holds a secret encoded as JSON with shape "S".

func NewJSONSecret

func NewJSONSecret[S any, IDR SecretIDer](p JSONSecretParams[IDR]) (secr *JSONSecret[S], err error)

NewJSONSecret inits the main component in this module.

func (*JSONSecret[S]) Static

func (s *JSONSecret[S]) Static() *S

Static returns a pointer to the static value of the secret as read on startup.

type JSONSecretParams

type JSONSecretParams[IDR SecretIDer] struct {
	fx.In
	Config IDR
	Cache  *secretcache.Cache
}

JSONSecretParams describes the dependencies for creating the json secret. It requires a type that can return the ID of the secret in the AWS secrets manager. Usually this is a configuration struct that implements the interface.

type Params

type Params struct {
	fx.In
	Config    Config
	AWSConfig aws.Config
}

type SecretIDer

type SecretIDer interface {
	AWSSecretID() string
}

SecretIDer describes a type that can return the ID of a secret in the AWS secrets manager.

Jump to

Keyboard shortcuts

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