config

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GsmOption

type GsmOption interface {
	// contains filtered or unexported methods
}

func WithGsmConfigType

func WithGsmConfigType(configType string) GsmOption

func WithGsmProjectId

func WithGsmProjectId(projectId string) GsmOption

func WithGsmResourceName

func WithGsmResourceName(resourceName string) GsmOption

func WithGsmUseJsonCreds

func WithGsmUseJsonCreds(jsonCreds []byte) GsmOption

func WithGsmUseJsonCredsFile

func WithGsmUseJsonCredsFile(jsonCredsFile string) GsmOption

type Manager

type Manager interface {
	Get(key string) interface{}
	GetBool(key string) bool
	GetBoolOrElse(key string, elseValue bool) bool
	GetFloat64(key string) float64
	GetFloat64OrElse(key string, elseValue float64) float64
	GetInt(key string) int
	GetIntOrElse(key string, elseValue int) int
	GetIntSlice(key string) []int
	GetIntSliceOrElse(key string, elseValue []int) []int
	GetString(key string) string
	GetStringOrElse(key string, elseValue string) string
	GetStringMap(key string) map[string]interface{}
	GetStringMapOrElse(key string, elseValue map[string]interface{}) map[string]interface{}
	GetStringMapString(key string) map[string]string
	GetStringMapStringOrElse(key string, elseValue map[string]string) map[string]string
	GetStringSlice(key string) []string
	GetMapArray(key string) []map[string]interface{}
	GetTime(key string) time.Time
	GetDuration(key string) time.Duration
	UnmarshalTo(key string, to interface{}) error
	IsSet(key string) bool
	AllSettings() map[string]interface{}
	Init() error
	MustInit() Manager
}

func New

func New() Manager

type Provider

type Provider interface {
	Init() error
	GetData() map[string]interface{}
}

func NewConfigLocal

func NewConfigLocal(name, ctype string, paths ...string) Provider

func NewGoogleSecretManager

func NewGoogleSecretManager(projectId, resourceName, configType string, opts ...GsmOption) Provider

NewGoogleSecretManager instantiate google secret manager with the given projectId and secret name The resource name of the [Secret][google.cloud.secretmanager.v1.Secret], in the format `projects/*/secrets/*`.

func NewRemote

func NewRemote(provider, address, path string) Provider

type RemoteProvider

type RemoteProvider string
const (
	RemoteProviderGSM    RemoteProvider = "google_secret_manager"
	RemoteProviderConsul RemoteProvider = "consul"
	RemoteProviderNone   RemoteProvider = "none"
)

func (RemoteProvider) String

func (rp RemoteProvider) String() string

type Type

type Type string
const (
	TypeYaml Type = "yaml"
	TypeJson Type = "json"
)

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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