config

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CmdKeyCommandYaml = "command"
	CmdKeyArgsYaml    = "args"
)

Yaml keys for Command props.

View Source
const (
	OptKeyServiceNameYaml = "service-name"
	OptKeyCommandsYaml    = "commands"
)

Variables

This section is empty.

Functions

func IsValid

func IsValid(log *logrus.Entry, o FileOptions) (errored bool)

Validate confirms that the Options instance contains all the required config values needed to start up the server.

Types

type CLIOptions

type CLIOptions interface {
	// Port returns the configured port number the HTTP server should bind to.
	// Defaults to "80".
	Port() uint16

	// ConfigPath returns the configured path to the service config file.
	// Defaults to "/app/config.yml".
	ConfigPath() string

	// WorkspacePath returns the configured workspace root directory.
	// Defaults to "/workspace"
	WorkspacePath() string

	// GetUsablePort returns the configured server port in the format expected by
	// the Golang HTTP server package.
	GetUsablePort() string
}

CLIOptions contains the values of the passed command line args (or the default values for those args).

func ParseCLIOptions

func ParseCLIOptions() (CLIOptions, error)

type Command

type Command struct {
	Executable string   `yaml:"executable" json:"executable"`
	Args       []string `yaml:"args" json:"arguments"`
}

Command is a container wrapping a command definition from the server configuration file.

func (Command) Validate

func (c Command) Validate() error

Validate confirms that the current Command instance is usable and that the cli command it defines exists on the path.

type FileOptions

type FileOptions interface {

	// Commands returns the command configured in the config.yml file.
	Commands() Command

	// FileTypes returns the configured allowed file types for the handler
	// command.
	FileTypes() []string

	// ServiceName returns the name of the configured service.
	ServiceName() string
}

FileOptions represents the options set in the yaml file.

TODO: this type is badly named, it should be command config or something.

func ParseFileOptions

func ParseFileOptions(path string) (FileOptions, error)

func ParseOptionsReader

func ParseOptionsReader(reader io.Reader) (FileOptions, error)

type InjectorProvider

type InjectorProvider func(
	*job.Details,
	*job.Metadata,
	*logrus.Entry,
) inject.VariableInjector

InjectorProvider defines a function that is used to construct and populate a VariableInjector instance with job context data.

func InjectorList

func InjectorList() []InjectorProvider

InjectorList returns a slice of providers for all VariableInjectors.

type Options

type Options struct {

	// Name of the service as it appears in health/status output.
	ServiceName string `yaml:"service-name" json:"serviceName"`

	// Configuration for the CLI call to the dataset tooling used to process
	// uploads.
	Command Command `yaml:"command" json:"command"`

	// Allowed list of raw upload file extensions.
	//
	// The service will handle zip and tar archives automatically.  This config
	// option simply controls what file extensions are allowed for uploads in
	// addition to the server's built in archive handling.
	//
	// Leaving this empty, or omitting it will mean that the server will only
	// accept it's own known archive formats, and will reject everything else.
	//
	// Setting this to, for example, ".txt" will result in the server allowing
	// file uploads for archive formats _and_ files ending in the extension
	// ".txt".
	FileTypes []string `yaml:"file-types" json:"fileTypes"`

	// CLI Option: Port the HTTP server will bind to on startup.
	Port uint16 `yaml:"-" json:"port"`

	// CLI Option: Path to the configuration file to use.
	ConfigPath string `yaml:"-" json:"configPath"`

	// Internal: The current service binary version as a string value.
	Version string `yaml:"-" json:"-"`

	Workspace string `yaml:"-" json:"workspace"`
}

Options is a container for the full configuration of the running server.

This includes both CLI params and configuration file contents.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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