Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultMHConfig = MHConfig{ Maintainers: []string{"none"}, PrintRendered: false, Simulate: false, TargetContext: "localhost", Team: "sre", SETValues: []string{""}, }
DefaultMHConfig is the default mh config and will most likely be modified during execution with the following sources by rising priority:
1. This default configuration 2. The "mh" key in the configuration file 3. Environment variables starting with "MH_" 4. Command line flags 5. app-specific overrides in MH_CONFIG.
Functions ¶
This section is empty.
Types ¶
type App ¶
App contains attributes defining a mh app to run and app-specific mh configuration overrides.
func NewApp ¶ added in v0.6.0
NewApp returns an App based on a appConfig and global MHConfig defaults.
type AppConfig ¶ added in v0.6.0
type AppConfig struct {
Alias string `yaml:"alias"`
File *AppFile `yaml:"file"`
Key string `yaml:"key"`
Name string `yaml:"name"`
Namespace string `yaml:"namespace"`
MHConfig
}
AppConfig is what can be defined in a mh configuration file and is used to create an App struct. It is a superset of MHConfig to enable app-specific configuration overrides of all mh configuration settings.
Maybe: Get rid of Alias in favor of ID
type AppConfigs ¶ added in v0.6.0
type AppConfigs []AppConfig
AppConfigs is an array of AppConfig as defined in a mh configuration file.
type AppFile ¶ added in v0.6.0
type AppFile struct {
Path *string `yaml:"path"`
}
AppFile is represents the way to retrieve a certain mh app. It may currently only contain a Path to a file on disk.
Todo: Extend AppFile, AppSources and App.render() together with alternative sources like git or s3.
type AppSource ¶
type AppSource struct {
AppSourceConfig
Files AppFiles
}
AppSource contains an AppSourceConfig and all AppFiles retrieved via it.
func NewAppSource ¶ added in v0.6.0
func NewAppSource(config AppSourceConfig, configFile string) (*AppSource, error)
NewAppSource returns an AppSource based on a given AppSourceConfig and path to mh configuration(for "configPath" kind of AppSources).
Todo: Get rid of "configFile" argument in favor of defined kinds of AppSources - see AppSourceConfig.
type AppSourceConfig ¶ added in v0.6.0
type AppSourceConfig struct {
Kind string `yaml:"kind"`
Name string `yaml:"name"`
Source string `yaml:"source"`
}
AppSourceConfig is what can be defined in a mh configuration file and is used create an AppSource struct. It defines where mh looks for app files.
Todo: Define kinds of sources here.
type AppSourceConfigs ¶ added in v0.6.0
type AppSourceConfigs []AppSourceConfig
AppSourceConfigs is an Array of AppSourceConfigs defined in a mh configuration file
type AppSources ¶ added in v0.6.0
type AppSources []AppSource
AppSources is an Array of AppSources at runtime.
func (*AppSources) File ¶ added in v0.6.0
func (as *AppSources) File(appConfig *AppConfig) bool
File calls AppSource.File on all AppSources and returns on the first match.
Todo: Add priorities in case of multiple matches.
type MHConfig ¶ added in v0.6.0
type MHConfig struct {
Maintainers []string `yaml:"maintainers"`
PrintRendered bool `yaml:"printRendered"`
Simulate bool `yaml:"simulate"`
TargetContext string `yaml:"targetContext"`
Team string `yaml:"team"`
SETValues []string
}
MHConfig is a set of options used during app deployment.
func MergeMHConfigs ¶ added in v0.6.0
MergeMHConfigs merges an arbitrary number of MHConfigs with rising priority.
type MHConfigFile ¶ added in v0.6.0
type MHConfigFile struct {
// TargetContext for backwards compatibility
TargetContext string `yaml:"targetContext"`
MH MHConfig `yaml:"mh"`
Apps AppConfigs `yaml:"apps"`
AppSources AppSourceConfigs `yaml:"appSources"`
}
MHConfigFile is the structure of a mh configuration file.
func (*MHConfigFile) EffectiveApps ¶ added in v0.6.0
func (c *MHConfigFile) EffectiveApps(logger *logrus.Entry, configFile string, filters []string, effectiveMHConfig MHConfig) (*Apps, error)
EffectiveApps returns all Apps that are configured in a MHConfigFile, optionally filtering them with given expressions. It matches them against the MHConfigFiles AppSourceConfigs, if their File is not overridden. Also passes a given logger and effective MHConfig down to them.
Todo: Support more than simple names as filter. Improve the below algorithm.