config

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvDatabasePassword = "GORT_DB_PASSWORD"
)

Variables

View Source
var (
	// ErrConfigFileNotFound is returned by Initialize() if the specified
	// config file doesn't exist.
	ErrConfigFileNotFound = errors.New("config file doesn't exist")

	// ErrHashFailure can be returned by Initialize() or internal methods if
	// there's an error while generating a hash for the configuration file.
	ErrHashFailure = errors.New("failed to generate config file hash")

	// ErrConfigUnloadable can be returned by Initialize() or internal
	// methods if the config file exists but can't be loaded.
	ErrConfigUnloadable = errors.New("can't load config file")
)

Functions

func GetDatabaseConfigs

func GetDatabaseConfigs() data.DatabaseConfigs

GetDatabaseConfigs returns the data wrapper for the "database" config section.

func GetDockerConfigs

func GetDockerConfigs() data.DockerConfigs

GetDockerConfigs returns the data wrapper for the "docker" config section.

func GetGlobalConfigs

func GetGlobalConfigs() data.GlobalConfigs

GetGlobalConfigs returns the data wrapper for the "global" config section.

func GetGortServerConfigs

func GetGortServerConfigs() data.GortServerConfigs

GetGortServerConfigs returns the data wrapper for the "gort" config section.

func GetJaegerConfigs

func GetJaegerConfigs() data.JaegerConfigs

GetJaegerConfigs returns the data wrapper for the "jaeger" config section.

func GetSlackProviders

func GetSlackProviders() []data.SlackProvider

GetSlackProviders returns the data wrapper for the "slack" config section.

func Initialize

func Initialize(file string) error

Initialize is called by main() to trigger creation of the config singleton. It can be called multiple times, if you're into that kind of thing. If successful, this will emit a StateConfigInitialized to any update listeners.

func IsUndefined

func IsUndefined(c interface{}) bool

IsUndefined is a helper method that is used to determine whether config sections are present.

func Reload added in v0.8.1

func Reload() error

Reload is called by Initialize() to determine whether the config file has changed (or is new) and reload if it has.

func Updates

func Updates() <-chan State

Updates returns a channel that emits a message whenever the underlying configuration is updated. Upon creation, it will emit the current state, so it never blocks.

Types

type State

type State byte

State represents a possible state of the config.

const (
	// StateConfigUninitialized is the default state of the config,
	// before initialization begins.
	StateConfigUninitialized State = iota

	// StateConfigInitialized indicates the config is fully initialized.
	StateConfigInitialized

	// StateConfigError indicates that the configuration file could not be
	// loaded and any calls to GetXConfig() will be invalid. This will only be
	// seen on the initial load attempt: if a config file changes and cannot be
	// loaded, the last good config will be used and the state will remain
	// 'initialized'
	StateConfigError
)

func CurrentState

func CurrentState() State

CurrentState returns the current state of the config.

func (State) String

func (s State) String() string

Jump to

Keyboard shortcuts

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