config

package
v0.0.0-...-4f6eca2 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: Apache-2.0, MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const CordialLogFormat = "CORDIAL_LOG_FORMAT"
View Source
const CordialLogLevel = "CORDIAL_LOG_LEVEL"

Variables

View Source
var NewVaultClient = newVaultClient

Functions

func ApplyDefaults

func ApplyDefaults(defaultCfg interface{}, overrideCfg interface{}, newCfg interface{}) error

func ConfigureLogger

func ConfigureLogger(levelMaybe ...string)

func GetSecret

func GetSecret(uri string) (string, error)

GetSecret returns a secret, e.g. from env variable. Extend as needed.

func HasTypePrefix

func HasTypePrefix(secretRef string) bool

func IsAllowedOverrideType

func IsAllowedOverrideType(existing interface{}, v interface{}) bool

func IsMap

func IsMap(v interface{}) bool

func RecusiveOverride

func RecusiveOverride(defaults map[string]interface{}, overrides map[string]interface{})

func RequireConfig

func RequireConfig(section string, unmarshalDst interface{}, defaults interface{}) error

Load configuration. 1. Read in a configuration file based on environment variables and current path. 2. If a section is provided, e.g. "crosschain", then only that section will be treated as root and deserialized. 3. You may optionally provide an existing configuration object with default values. 4. If defaults are provided, an error will _not_ be returned if no config is found.

func RequireConfigWithViper

func RequireConfigWithViper(v *viper.Viper, section string, unmarshalDst interface{}, defaults interface{}) error

Types

type DefaultVaultLoader

type DefaultVaultLoader struct {
	*vault.Client
}

func (*DefaultVaultLoader) LoadSecretData

func (v *DefaultVaultLoader) LoadSecretData(vaultPath string) (*vault.Secret, error)

type Secret

type Secret string

func NewRawSecret

func NewRawSecret(secret string) Secret

func (Secret) Load

func (s Secret) Load() (string, error)

func (Secret) LoadOrBlank

func (s Secret) LoadOrBlank() string

type SecretType

type SecretType string
var Env SecretType = "env"
var File SecretType = "file"
var GoogleSecretManager SecretType = "gsm"
var Raw SecretType = "raw"
var Vault SecretType = "vault"

type VaultLoader

type VaultLoader interface {
	LoadSecretData(path string) (*vault.Secret, error)
}

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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