Documentation
¶
Index ¶
Constants ¶
const ( // LogLevelDefault is the log level used when one has not been // specified in an environment variable or in configuration file. LogLevelDefault = "info" // NoProjectWarning is the message provided to the user when no project // could be found NoProjectWarning = `` /* 239-byte string literal not displayed */ )
Variables ¶
var ConfigFileDefaults = []string{".dev.yml", ".dev.yaml", "dev.yml", "dev.yaml"}
ConfigFileDefaults are the default filenames for the configuration file for this program.
Functions ¶
Types ¶
type Dev ¶
type Dev struct {
Log LogConfig `mapstructure:"log"`
Projects map[string]*Project `mapstructure:"projects"`
Registries map[string]*Registry `mapstructure:"registries"`
// Filename is the full path of the configuration file containing
// this configuration. This is used internally and is ignored
// if specified by the user.
Filename string
// Dir is either the location of the config file or the current
// working directory if there is no config file. This is used
// intenrally and is ignored if specified by the user.
Dir string
// Networks are a list of the networks managed by dev. A network
// will be created automatically as required by dev if it is listed
// as a dependency of your project. These are networks that are used
// as 'external networks' in your docker-compose configuration.
Networks map[string]*types.NetworkCreate `mapstructure:"networks"`
// ImagePrefix is the prefix to add to images built with this
// tool through compose. Compose forces the use of a prefix so we
// allow the configuration of that prefix here. Dev must know the
// prefix in order to perform some image specific operations. If not
// set, this defaults to the directory where the this tool's config
// file is located or the directory or the docker-compose.yml if one is
// found. Note that compose only adds the prefix to local image
// builds.
ImagePrefix string `mapstructure:"image_prefix"`
}
Dev is the datastructure into which we unmarshal the dev configuration file.
func NewConfig ¶
func NewConfig() *Dev
NewConfig structs the default configuration structure for dev driven projects.
func (*Dev) RunnableProjects ¶
RunnableProjects returns the Project configuration of each Project that has a docker-compose.yml file and is not hidden by configuration.
type LogConfig ¶
type LogConfig struct {
Level string `mapstructure:"level"`
}
LogConfig holds the logging related configuration.
type Project ¶
type Project struct {
// The paths of the docker compose files for this project. Can be
// relative or absolute paths.
DockerComposeFilenames []string `mapstructure:"docker_compose_files"`
// The path of the root of the project (or its basename). Do we need this?
Directory string `mapstructure:"directory"`
// Ignored if set by user.
Name string `mapstructure:"name"`
// Alternate names for this project.
Aliases []string `mapstructure:"aliases"`
// Whether project should be included for use by this project, default false
Hidden bool `mapstructure:"hidden"`
// Shell used to enter the project container with 'sh' command,
// default is /bin/bash
Shell string `mapstructure:"shell"`
// Projects, registries, networks on which this project depends.
Dependencies []string `mapstructure:"depends_on"`
}
Project configuration structure. This must be used when using more than one docker-compose.yml file for a project.
type Registry ¶
type Registry struct {
// User readable name, not used by the docker client
Name string `mapstructure:"name"`
URL string `mapstructure:"url"`
// TODO: other forms of auth exist and should be supported, but this is
// what I need..
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
// Sometimes these can be firewalled, so a default timeout of 2 seconds
// is provided, though can be tweaked here
TimeoutSeconds int64 `mapstructure:"timeout_seconds"`
// if login or connection fails, should dev continue with command or
// fail hard. Default is True
ContinueOnFailure bool `mapstructure:"continue_on_failure"`
}
Registry repesents the configuration required to model a container registry. Users can configure their project to be dependent on a registry. When this occurs, we will login to the container registry using the configuration provided here. This will allow users to host their images in private image repos.