config

package
v2.1.10 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SELF_NAME = "configmanager"
)

Variables

View Source
var ErrInvalidTokenPrefix = errors.New("token prefix has no implementation")
View Source
var (
	// default varPrefix used by the replacer function
	// any token must beging with one of these else
	// it will be skipped as not a replaceable token
	VarPrefix = map[ImplementationPrefix]bool{
		SecretMgrPrefix: true, ParamStorePrefix: true, AzKeyVaultSecretsPrefix: true,
		GcpSecretsPrefix: true, HashicorpVaultPrefix: true, AzTableStorePrefix: true,
		AzAppConfigPrefix: true, UnknownPrefix: true,
	}
)

Functions

This section is empty.

Types

type GenVarsConfig

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

GenVarsConfig defines the input config object to be passed

func NewConfig

func NewConfig() *GenVarsConfig

NewConfig

func (*GenVarsConfig) Config

func (c *GenVarsConfig) Config() GenVarsConfig

Config returns the derefed value

func (*GenVarsConfig) EnvSubstEnabled

func (c *GenVarsConfig) EnvSubstEnabled() bool

EnvSubstEnabled returns whether or not envsubst is enabled

func (*GenVarsConfig) KeySeparator

func (c *GenVarsConfig) KeySeparator() string

KeySeparator returns the keySeparator set in the config

func (*GenVarsConfig) OutputPath

func (c *GenVarsConfig) OutputPath() string

OutputPath returns the outpath set in the config

func (*GenVarsConfig) TokenSeparator

func (c *GenVarsConfig) TokenSeparator() string

TokenSeparator returns the tokenSeparator set in the config

func (*GenVarsConfig) WithEnvSubst

func (c *GenVarsConfig) WithEnvSubst(enabled bool) *GenVarsConfig

WithKeySeparator adds a custom key separotor

func (*GenVarsConfig) WithKeySeparator

func (c *GenVarsConfig) WithKeySeparator(keySeparator string) *GenVarsConfig

WithKeySeparator adds a custom key separotor

func (*GenVarsConfig) WithOutputPath

func (c *GenVarsConfig) WithOutputPath(out string) *GenVarsConfig

WithOutputPath

func (*GenVarsConfig) WithTokenSeparator

func (c *GenVarsConfig) WithTokenSeparator(tokenSeparator string) *GenVarsConfig

WithTokenSeparator adds a custom token separator token is the actual value of the parameter/secret in the provider store

type ImplementationPrefix

type ImplementationPrefix string
const (
	// AWS SecretsManager prefix
	SecretMgrPrefix ImplementationPrefix = "AWSSECRETS"
	// AWS Parameter Store prefix
	ParamStorePrefix ImplementationPrefix = "AWSPARAMSTR"
	// Azure Key Vault Secrets prefix
	AzKeyVaultSecretsPrefix ImplementationPrefix = "AZKVSECRET"
	// Azure Key Vault Secrets prefix
	AzTableStorePrefix ImplementationPrefix = "AZTABLESTORE"
	// Azure App Config prefix
	AzAppConfigPrefix ImplementationPrefix = "AZAPPCONF"
	// Hashicorp Vault prefix
	HashicorpVaultPrefix ImplementationPrefix = "VAULT"
	// GcpSecrets
	GcpSecretsPrefix ImplementationPrefix = "GCPSECRETS"
	// Unknown
	UnknownPrefix ImplementationPrefix = "UNKNOWN"
)

type ParsedTokenConfig

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

func NewParsedTokenConfig

func NewParsedTokenConfig(token string, config GenVarsConfig) (*ParsedTokenConfig, error)

NewParsedTokenConfig returns a pointer to a new TokenConfig struct returns nil if current prefix does not correspond to an Implementation

The caller needs to make sure it is not nil TODO: a custom parser would be best here

func (*ParsedTokenConfig) LookupKeys

func (t *ParsedTokenConfig) LookupKeys() string

func (*ParsedTokenConfig) ParseMetadata

func (t *ParsedTokenConfig) ParseMetadata(metadataTyp any) error

func (*ParsedTokenConfig) Prefix

func (*ParsedTokenConfig) StoreToken

func (t *ParsedTokenConfig) StoreToken() string

Strip

returns the only the store indicator string without any of the configmanager token enrichment:

- metadata

- keySeparator

- keys

- prefix

func (*ParsedTokenConfig) String

func (t *ParsedTokenConfig) String() string

Full returns the full Token path. Including key separator and metadata values

func (*ParsedTokenConfig) StripMetadata

func (t *ParsedTokenConfig) StripMetadata() string

StripMetadata returns the fullToken without the metadata

func (*ParsedTokenConfig) StripPrefix

func (t *ParsedTokenConfig) StripPrefix() string

Jump to

Keyboard shortcuts

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