Runtime hacks (#1344)

* Add Args/Image to runtime

* remove the hacks
This commit is contained in:
Asim Aslam
2020-03-13 18:39:59 +00:00
committed by GitHub
parent 3543b275e0
commit e803fb0855
12 changed files with 166 additions and 102 deletions

View File

@@ -14,6 +14,8 @@ type Options struct {
Type string
// Source of the services repository
Source string
// Base image to use
Image string
}
// WithSource sets the base image / repository
@@ -37,14 +39,23 @@ func WithType(t string) Option {
}
}
// WithImage sets the image to use
func WithImage(t string) Option {
return func(o *Options) {
o.Image = t
}
}
type CreateOption func(o *CreateOptions)
type ReadOption func(o *ReadOptions)
// CreateOptions configure runtime services
type CreateOptions struct {
// command to execute including args
// Command to execut
Command []string
// Args to pass into command
Args []string
// Environment to configure
Env []string
// Log output
@@ -53,8 +64,8 @@ type CreateOptions struct {
Type string
// Retries before failing deploy
Retries int
// Source of the service
Source string
// Specify the image to use
Image string
}
// ReadOptions queries runtime services
@@ -74,18 +85,26 @@ func CreateType(t string) CreateOption {
}
}
// CreateSource sets the source of service to create
func CreateSource(t string) CreateOption {
// CreateImage sets the image to use
func CreateImage(img string) CreateOption {
return func(o *CreateOptions) {
o.Source = t
o.Image = img
}
}
// WithCommand specifies the command to execute
func WithCommand(args ...string) CreateOption {
func WithCommand(cmd ...string) CreateOption {
return func(o *CreateOptions) {
// set command
o.Command = args
o.Command = cmd
}
}
// WithArgs specifies the command to execute
func WithArgs(args ...string) CreateOption {
return func(o *CreateOptions) {
// set command
o.Args = args
}
}