Documentation
¶
Index ¶
- Constants
- Variables
- func BeginChangeCheck(frequency time.Duration)
- func CommandEntryFinder() bundles.CommandEntryFinder
- func GetBundleConfigs() []data.Bundle
- func GetDatabaseConfigs() data.DatabaseConfigs
- func GetDockerConfigs() data.DockerConfigs
- func GetGlobalConfigs() data.GlobalConfigs
- func GetGortServerConfigs() data.GortServerConfigs
- func GetSlackProviders() []data.SlackProvider
- func Initialize(file string) error
- func Updates() <-chan State
- type ConfigCommandEntryFinder
- type State
Constants ¶
const (
EnvDatabasePassword = "GORT_DB_PASSWORD"
)
Variables ¶
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 BeginChangeCheck ¶
BeginChangeCheck starts a routine that checks the underlying config for changes and reloads if one is found.
func CommandEntryFinder ¶
func CommandEntryFinder() bundles.CommandEntryFinder
CommandEntryFinder returns a bundles.CommandEntryFinder implementation that allows interrogation of the bundles described in the config in a way that's compliant with the bundles.CommandEntryFinder interface.
func GetBundleConfigs ¶
GetBundleConfigs returns the data wrapper for the "bundles" config section.
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 GetSlackProviders ¶
func GetSlackProviders() []data.SlackProvider
GetSlackProviders returns the data wrapper for the "slack" config section.
func Initialize ¶
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.
Types ¶
type ConfigCommandEntryFinder ¶
type ConfigCommandEntryFinder struct{}
ConfigCommandEntryFinder just has a FindCommandEntry() function so that config can provide functionality that's compliant with the bundles.CommandEntryFinder interface.
func (ConfigCommandEntryFinder) FindCommandEntry ¶
func (c ConfigCommandEntryFinder) FindCommandEntry(ctx context.Context, bundleName, commandName string) ([]data.CommandEntry, error)
FindCommandEntry looks for a command in the configuration. It assumes that command character(s) have already been removed, and expects a string in the format "bundle:command" or "command"; the latter can return multiple values if a similarly-named command is found in multiple bundles.
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 )