Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var SupportedRuntimes []RuntimeType = []RuntimeType{ Native, NodeJS, Java, }
Functions ¶
func BootCmdForScript ¶
BootCmdForScript returns boot command that is to be used to run config set with name bootName.
func PrependEnvsPrefix ¶
PrependEnvsPrefix prepends all key-values of env map to the boot cmd give. It prepends each pair in a form of "--env={KEY}={VALUE}". Also performs check that neither key nor value contains space. Argument `soft` means that operator '?=' is used that only sets env variable if it's not set yet.
Types ¶
type CommonRuntime ¶
CommonRuntime fields are those common to all runtimes. This fields are set for each named-configuration separately, nothing is shared.
func (CommonRuntime) BuildBootCmd ¶
func (r CommonRuntime) BuildBootCmd(bootCmd string) (string, error)
BuildBootCmd equips runtime-specific bootcmd with common parts.
func (CommonRuntime) GetEnv ¶
func (r CommonRuntime) GetEnv() map[string]string
func (CommonRuntime) GetYamlTemplate ¶
func (r CommonRuntime) GetYamlTemplate() string
func (CommonRuntime) Validate ¶
func (r CommonRuntime) Validate() error
type Runtime ¶
type Runtime interface {
// Validate values that were read from yaml.
Validate() error
// GetBootCmd produces bootcmd based on meta/run.yaml.
GetBootCmd() (string, error)
// GetRuntimeName returns unique runtime name
// (use constant from the SupportedRuntimes list)
GetRuntimeName() string
// GetRuntimeDescription provides short description about what
// is this runtime used for, 50 chars
GetRuntimeDescription() string
// OnCollect is a callback to run when collecting package
// (accepts directroy path of the package)
OnCollect(string) error
// GetYamlTemplate provides a string containing yaml content with
// as much help text as possible.
// NOTE: provide only runtime-specific part of yaml, see runtime/node.go for example.
// NOTE: Write each comment in its own line for --plain flag to remove it.
GetYamlTemplate() string
// GetDependencies returns a list of dependent package names.
GetDependencies() []string
// GetEnv returns map of environment variables read from run.yaml.
GetEnv() map[string]string
}
Runtime interface must be extended for every new runtime. Typically, a runtime struct contains fileds that are expected in meta/run.yaml and implements the functions required by this interface.
func PickRuntime ¶
func PickRuntime(runtimeName RuntimeType) (Runtime, error)
PickRuntime maps runtime name into runtime struct.
type RuntimeType ¶
type RuntimeType string
const ( Native RuntimeType = "native" NodeJS RuntimeType = "node" Java RuntimeType = "java" )