config

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2022 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandDefinition

type CommandDefinition struct {
	// OS is set to load this configuration only when executed from the given operating system.
	// accepted values are: "windows", "linux" , "darwin"
	OS *string
	// RequireEnvVars requires all EnvVars to be resolvable.
	// If a variable is not set, the command fails.
	RequireEnvVars *bool
	// IsTemplate prevents an executable file to be generated for this command entry.
	IsTemplate *bool
	// Template defines the template commands name that settings will be used as a base for this command.
	Template *string
	// EntryPoint represents the docker flag --entrypoint
	EntryPoint *string
	// Command represents the docker run [COMMAND] part.
	Command *string
	// Name represents the docker run flag --name
	Name *string
	// UniqueNames will make Name unique by appending a unique value to the Name.
	UniqueNames *bool
	// Image represents the docker Image to be used.
	Image *string
	// Network represents the docker run flag --network.
	Network *string
	// EnvFile represents the docker run flag --env-file
	EnvFile *string
	// EnvFile represents the docker run flag --ip
	IP *string
	// IsInteractive sets -i and if IsInteractive is set true, attaches (-a) streams STDIN STDOUT STDERR
	IsInteractive *bool
	// IsDetached represents the docker run flag -d
	IsDetached *bool
	// IsDaemon represents the docker run flag -d
	IsDaemon *bool // deprecated
	// Volumes holds a list of volume mappings which correspond to the docker run flag -v
	Volumes *[]string
	// Links holds a list of links which correspond to the docker run flag --link
	Links *[]string
	// EnvVars holds a list of environment variable mappings which correspond to the docker run flag -e
	EnvVars *[]string
	// Ports holds a list of port mappings which correspond to the docker run flag -p
	Ports *[]string
	// PortsFromParams holds a list of regular expressions that are used to read a port from a command argument.
	// The parsed port will be applied like follows: -p port:port.
	PortsFromParams *[]string
	// MergeTemplateArrays holds a list of array names that should be applied from the template and merged with
	// The current command. By default a array definition in a command would overwrite a template array.
	// Possible to merge are the following arrays: Volumes, Links, EnvVars, Ports, PortsFromParams, AdditionalArgs.
	MergeTemplateArrays *[]string
	// AddGroups, if set to true, will automatically resolve and add the current user groups to the container.
	// The corresponding docker run flag is --group-add.
	AddGroups *bool
	// Impersonate sets the current user,group for the container.  docker run flag -u.
	Impersonate *bool
	// WorkDir sets the workdir inside the container. docker run flag -w.
	WorkDir *string
	// AutoMountWorkDir will add a volume mapping for the current WorkDir like this: -v WorkDir:WorkDir
	AutoMountWorkDir *bool
	// RemoveContainer removes the container after execution. docker flag --rm.
	RemoveContainer *bool
	// ReplaceArgs allows to manipulate the command arguments.
	// Each entry must be an array of two entries. The first entry defines which argument shall be replaced, the second
	// one defines the replacement.
	// Example: [["arg2", "arg99"]] would replace "arg2" with "arg99".
	ReplaceArgs *[][]string
	// AdditionalArgs contains a list of strings that are prepended the original command arguments.
	AdditionalArgs *[]string
}

CommandDefinition gives public access to the fields by accessor functions.

func (CommandDefinition) GetAddGroups

func (c CommandDefinition) GetAddGroups() (bool, bool)

GetAddGroups returns value of IsInteractive and an boolean indicating if value is set.

func (CommandDefinition) GetAdditionalArgs added in v0.2.0

func (c CommandDefinition) GetAdditionalArgs() ([]string, bool)

GetAdditionalArgs returns value of AdditionalArgs and an boolean indicating if value is set.

func (CommandDefinition) GetAutoMountWorkDir added in v0.6.0

func (c CommandDefinition) GetAutoMountWorkDir() (bool, bool)

GetAutoMountWorkDir returns value of AutoMountWorkDir and an boolean indicating if value is set.

func (CommandDefinition) GetCommand added in v0.2.0

func (c CommandDefinition) GetCommand() (string, bool)

getCommand returns value of Command (CMD) and an boolean indicating if value is set.

func (CommandDefinition) GetEntryPoint

func (c CommandDefinition) GetEntryPoint() (string, bool)

GetEntryPoint returns entrypoint and an boolean indicating if value is set.

func (CommandDefinition) GetEnvFile added in v0.3.0

func (c CommandDefinition) GetEnvFile() (string, bool)

GetEnvFile returns value of EnvFile and an boolean indicating if value is set.

func (CommandDefinition) GetEnvVars

func (c CommandDefinition) GetEnvVars() ([]string, bool)

GetEnvVars returns value of EnvVars and an boolean indicating if value is set.

func (CommandDefinition) GetIP added in v0.5.1

func (c CommandDefinition) GetIP() (string, bool)

GetIP returns value of Ip and an boolean indicating if value is set.

func (CommandDefinition) GetImage

func (c CommandDefinition) GetImage() (string, bool)

GetImage returns value of Image and an boolean indicating if value is set.

func (CommandDefinition) GetImpersonate

func (c CommandDefinition) GetImpersonate() (bool, bool)

GetImpersonate returns value of Impersonate and an boolean indicating if value is set.

func (CommandDefinition) GetIsDetached added in v0.5.2

func (c CommandDefinition) GetIsDetached() (bool, bool)

GetIsDetached returns value of GetIsDetached and an boolean indicating if value is set.

func (CommandDefinition) GetIsInteractive

func (c CommandDefinition) GetIsInteractive() (bool, bool)

GetIsInteractive returns value of IsInteractive and an boolean indicating if value is set.

func (CommandDefinition) GetIsTemplate

func (c CommandDefinition) GetIsTemplate() (bool, bool)

GetIsTemplate returns value of IsTemplate and an boolean indicating if value is set.

func (c CommandDefinition) GetLinks() ([]string, bool)

GetLinks returns value of Links and an boolean indicating if value is set.

func (CommandDefinition) GetMergeTemplateArrays added in v0.6.0

func (c CommandDefinition) GetMergeTemplateArrays() ([]string, bool)

GetMergeTemplateArrays returns value of MergeTemplateArrays and an boolean indicating if value is set.

func (CommandDefinition) GetName

func (c CommandDefinition) GetName() (string, bool)

GetName returns value of Name and an boolean indicating if value is set.

func (CommandDefinition) GetNetwork

func (c CommandDefinition) GetNetwork() (string, bool)

GetNetwork returns value of Network and an boolean indicating if value is set.

func (CommandDefinition) GetOS added in v0.7.0

func (c CommandDefinition) GetOS() (string, bool)

GetOS returns value of OS and an boolean indicating if value is set.

func (CommandDefinition) GetPorts

func (c CommandDefinition) GetPorts() ([]string, bool)

GetPorts returns value of Ports and an boolean indicating if value is set.

func (CommandDefinition) GetPortsFromParams added in v0.5.0

func (c CommandDefinition) GetPortsFromParams() ([]string, bool)

GetPortsFromParams returns value of Ports and an boolean indicating if value is set.

func (CommandDefinition) GetRemoveContainer

func (c CommandDefinition) GetRemoveContainer() (bool, bool)

GetRemoveContainer returns value of RemoveContainer and an boolean indicating if value is set.

func (CommandDefinition) GetReplaceArgs added in v0.2.0

func (c CommandDefinition) GetReplaceArgs() ([][]string, bool)

GetReplaceArgs returns value of ReplaceArgs and an boolean indicating if value is set.

func (CommandDefinition) GetRequireEnvVars added in v0.2.0

func (c CommandDefinition) GetRequireEnvVars() (bool, bool)

GetRequireEnvVars returns value of RequireEnvVars and an boolean indicating if value is set.

func (CommandDefinition) GetTemplate

func (c CommandDefinition) GetTemplate() (string, bool)

GetTemplate returns value of Template and an boolean indicating if value is set.

func (CommandDefinition) GetUniqueNames added in v0.2.0

func (c CommandDefinition) GetUniqueNames() (bool, bool)

GetUniqueNames returns value of UniqueNames and an boolean indicating if value is set.

func (CommandDefinition) GetVolumes

func (c CommandDefinition) GetVolumes() ([]string, bool)

GetVolumes returns value of Volumes and an boolean indicating if value is set.

func (CommandDefinition) GetWorkDir

func (c CommandDefinition) GetWorkDir() (string, bool)

GetWorkDir returns value of Impersonate and an boolean indicating if value is set.

func (CommandDefinition) HasName

func (c CommandDefinition) HasName() bool

HasName indicates if the command definition has Name.

func (CommandDefinition) HasTemplate

func (c CommandDefinition) HasTemplate() bool

HasTemplate indicates if the command definition has a template set.

func (CommandDefinition) IsTemplateArrayMerged added in v0.6.0

func (c CommandDefinition) IsTemplateArrayMerged(arrayKeyName string) bool

IsTemplateArrayMerged returns true if the given identifier is part of MergeTemplateArrays.

type Configuration

type Configuration struct {
	Command        []CommandDefinition
	Version        string
	ConfigFilePath string
	Logging        bool
	// contains filtered or unexported fields
}

Configuration defines the fields/types of the configuration file.

func (Configuration) FindCommandByName

func (c Configuration) FindCommandByName(commandName string) (CommandDefinition, error)

FindCommandByName finds a command by the given name.

func (Configuration) GetConfigurationFilePath

func (c Configuration) GetConfigurationFilePath() string

GetConfigurationFilePath returns the path the configuration was load from. this is for debugging purpose.

type Loader added in v0.4.0

type Loader struct{}

func NewLoader added in v0.2.0

func NewLoader() Loader

NewLoader returns a new config loader.

func (Loader) Load added in v0.4.0

func (cl Loader) Load() Configuration

Load loads the configuration file.

Jump to

Keyboard shortcuts

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