Documentation ¶
Index ¶
- type EnvCommand
- type FileGenFunc
- type FileGenMap
- type ModuleDef
- type ProjectConfig
- func (cfg *ProjectConfig) ComposeConfig() (map[string]interface{}, error)
- func (cfg *ProjectConfig) ComposeFilePath() string
- func (cfg *ProjectConfig) FilesToGenerate() (FileGenMap, error)
- func (cfg *ProjectConfig) LoadEnv() error
- func (cfg *ProjectConfig) Save() error
- func (cfg *ProjectConfig) ToMap() (map[string]interface{}, error)
- func (cfg *ProjectConfig) Warn(msg string)
- type SecretCommand
- type StatusConfig
- type UserConfig
- type UserModuleConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EnvCommand ¶
type EnvCommand struct { Exec []string `yaml:"exec"` Parse bool `yaml:"parse"` Varname string `yaml:"varname"` }
EnvCommand is a command that sets (an) env var(s).
func (*EnvCommand) ShouldParse ¶
func (e *EnvCommand) ShouldParse() bool
ShouldParse is true if the output should be parsed and false if varname should be used.
func (*EnvCommand) Value ¶
func (e *EnvCommand) Value() ([]byte, error)
Value will run the command and return the output.
func (*EnvCommand) VarName ¶
func (e *EnvCommand) VarName() string
VarName returns the name of the env var that the command will set.
type FileGenFunc ¶
FileGenFunc is a function that takes a string (file path) and generates the file at that path (returning an error).
type FileGenMap ¶
type FileGenMap map[string]FileGenFunc
FileGenMap is just a map of the file path to its FileGenFunc.
type ModuleDef ¶
type ModuleDef struct { Configs map[string]interface{} `yaml:"configs"` File string `yaml:"file"` Name string `yaml:"name"` }
ModuleDef represents a module definition read from a file.
type ProjectConfig ¶
type ProjectConfig struct { ModuleDefinitions []*ModuleDef `yaml:"module_definitions"` UserFile string `yaml:"user_file"` User *UserConfig `yaml:"user"` ModuleFiles []string `yaml:"module_files"` SecretCommands map[string]*SecretCommand `yaml:"secret_commands"` SecretPassphrase string `yaml:"secret_passphrase"` DefaultModuleOrder []string `yaml:"default_module_order"` Status *StatusConfig `yaml:"status"` ProjectName string `yaml:"project_name"` ComposeFile string `yaml:"compose_file"` DeprecatedServiceDefinitions []*ModuleDef `yaml:"service_definitions,omitempty"` DeprecatedServiceFiles []string `yaml:"service_files,omitempty"` DeprecatedDefaultServicePreference []string `yaml:"default_service_preference,omitempty"` Secrets []envLoader `yaml:"-"` ProjectFile string `yaml:"-"` LoadError error `yaml:"-"` Warnings []string `yaml:"-"` // contains filtered or unexported fields }
ProjectConfig is a type for the parsed contents of the project config file.
func NewConfigFromDefaultFile ¶
func NewConfigFromDefaultFile() (*ProjectConfig, error)
NewConfigFromDefaultFile will attempt to load the config from files.
func NewConfigFromMap ¶
func NewConfigFromMap(cfgMap map[string]interface{}) (*ProjectConfig, error)
NewConfigFromMap returns new ProjectConfig from map[string]interface{}.
func (*ProjectConfig) ComposeConfig ¶
func (cfg *ProjectConfig) ComposeConfig() (map[string]interface{}, error)
ComposeConfig returns a map[string]interface ready to be yaml dumped as a docker-compose.yml file.
func (*ProjectConfig) ComposeFilePath ¶
func (cfg *ProjectConfig) ComposeFilePath() string
ComposeFilePath returns the path of the target compose file.
func (*ProjectConfig) FilesToGenerate ¶
func (cfg *ProjectConfig) FilesToGenerate() (FileGenMap, error)
FilesToGenerate returns a FileGenMap of files to write.
func (*ProjectConfig) LoadEnv ¶
func (cfg *ProjectConfig) LoadEnv() error
LoadEnv will load environment variables from all config sources including project_name and secret commands.
func (*ProjectConfig) Save ¶
func (cfg *ProjectConfig) Save() error
Save writes out the generated config files to disk.
func (*ProjectConfig) ToMap ¶
func (cfg *ProjectConfig) ToMap() (map[string]interface{}, error)
ToMap returns new map[string]interface{} from ProjectConfig
func (*ProjectConfig) Warn ¶
func (cfg *ProjectConfig) Warn(msg string)
Warn adds a warning to the config (which the commands will print) (as long as the message hasn't already been Warn()ed).
type SecretCommand ¶
type SecretCommand struct { Cache string `yaml:"cache"` Exec []string `yaml:"exec"` EnvCommands []*EnvCommand `yaml:"env_commands"` Passphrase string `yaml:"passphrase"` }
SecretCommand holds setup information for secrets that use it.
type StatusConfig ¶
type StatusConfig struct { Exec []string `yaml:"exec"` LineFormat string `yaml:"line_format"` Interval time.Duration `yaml:"interval"` }
StatusConfig defines how to determine project status.
type UserConfig ¶
type UserConfig struct { ModuleOrder []string `yaml:"module_order"` Modules map[string]UserModuleConfig `yaml:"modules"` Override map[string]interface{} `yaml:"override"` DeprecatedServicePreference []string `yaml:"service_preference,omitempty"` DeprecatedServices map[string]UserModuleConfig `yaml:"services,omitempty"` }
UserConfig represents the user's customization file.
func UserConfigFromMap ¶
func UserConfigFromMap(cfgMap map[string]interface{}) (*UserConfig, error)
UserConfigFromMap returns new UserConfig from map[string]interface{}
func (*UserConfig) ToMap ¶
func (cfg *UserConfig) ToMap() (map[string]interface{}, error)
ToMap returns new map[string]interface{} from UserConfig
type UserModuleConfig ¶
UserModuleConfig represents the user's configuration for a module.