repository

package
v0.0.0-...-e163d20 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SecretPrefix = "configleam:secret"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Encryptor

type Encryptor interface {
	Encrypt(ctx context.Context, b []byte) ([]byte, error)
	Decrypt(ctx context.Context, b []byte) ([]byte, error)
}

type EtcdRepository

type EtcdRepository struct {
	*etcd.Etcd
	// contains filtered or unexported fields
}

func NewEtcdRepository

func NewEtcdRepository(etcd *etcd.Etcd, encryptor Encryptor) *EtcdRepository

func (*EtcdRepository) CloneSecrets

func (r *EtcdRepository) CloneSecrets(ctx context.Context, env, newEnv string) error

func (*EtcdRepository) DeleteSecrets

func (r *EtcdRepository) DeleteSecrets(ctx context.Context, env string) error

DeleteSecrets deletes all secrets keys for a specific environment.

func (*EtcdRepository) GetBaseKey

func (r *EtcdRepository) GetBaseKey(env string) string

func (*EtcdRepository) GetSecret

func (r *EtcdRepository) GetSecret(ctx context.Context, env, fullKey string) (interface{}, error)

func (*EtcdRepository) GetSecretKey

func (r *EtcdRepository) GetSecretKey(env, key string) string

func (*EtcdRepository) UpsertSecrets

func (r *EtcdRepository) UpsertSecrets(ctx context.Context, env string, secrets map[string]interface{}) error

type RedisRepository

type RedisRepository struct {
	*rds.Redis
	// contains filtered or unexported fields
}

func NewRedisRepository

func NewRedisRepository(redis *rds.Redis, encryptor Encryptor) *RedisRepository

func (*RedisRepository) CloneSecrets

func (r *RedisRepository) CloneSecrets(ctx context.Context, cloneEnv, newEnv string) error

func (*RedisRepository) DeleteSecrets

func (r *RedisRepository) DeleteSecrets(ctx context.Context, env string) error

func (*RedisRepository) GetCloneSecretsDeletePatternKey

func (r *RedisRepository) GetCloneSecretsDeletePatternKey(clonedEnv string) string

func (*RedisRepository) GetCloneSecretsPatternKey

func (r *RedisRepository) GetCloneSecretsPatternKey(cloneEnv string) string

func (*RedisRepository) GetSecret

func (r *RedisRepository) GetSecret(ctx context.Context, env, fullKey string) (interface{}, error)

func (*RedisRepository) GetSecretKey

func (r *RedisRepository) GetSecretKey(env, key string) string

func (*RedisRepository) UpsertSecrets

func (r *RedisRepository) UpsertSecrets(ctx context.Context, env string, secrets map[string]interface{}) error

type Repository

type Repository interface {
	GetSecret(ctx context.Context, env string, key string) (interface{}, error)
	UpsertSecrets(ctx context.Context, env string, secrets map[string]interface{}) error
	CloneSecrets(ctx context.Context, cloneEnv, newEnv string) error
}

func New

func New(ctx context.Context, cfg RepositoryConfig, encryptor Encryptor) (Repository, error)

type RepositoryConfig

type RepositoryConfig struct {
	RedisAddrs    string
	RedisUsername string
	RedisPassword string
	RedisTLS      bool

	EtcdAddrs    []string
	EtcdUsername string
	EtcdPassword string
	EtcdTLS      bool
}

type SecretNotFoundError

type SecretNotFoundError struct {
	Key string
}

func (SecretNotFoundError) Error

func (e SecretNotFoundError) Error() string

Jump to

Keyboard shortcuts

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