run

package
v0.0.0-...-4fdfd55 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Version   string
	Branch    string
	Commit    string
	BuildTime string

	Closed chan struct{}

	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer

	Logger log.Logger
	// contains filtered or unexported fields
}

Command represents the command executed by "emailsender run".

func NewCommand

func NewCommand() *Command

NewCommand return a new instance of Command.

func (*Command) Close

func (cmd *Command) Close()

func (*Command) ParseConfig

func (cmd *Command) ParseConfig(path string) (*Config, error)

ParseConfig parses the config at path. It returns a demo configuration if path is blank.

func (*Command) ParseFlags

func (cmd *Command) ParseFlags(args ...string) (Options, error)

ParseFlags parses the command line flags from args and returns an options set.

func (*Command) Run

func (cmd *Command) Run(args ...string) error

type Config

type Config struct {
	BugsnagAPIKey string
	LogLevel      string

	Worker worker.Config
}

func NewConfig

func NewConfig() *Config

func NewDefaultConfig

func NewDefaultConfig() (*Config, error)

NewDefaultConfig returns the config that runs when no config is specified.

func (*Config) Load

func (c *Config) Load(fpath string) error

Load loads the config from a TOML file.

func (*Config) Parse

func (c *Config) Parse(input string) error

Parse parses the config from TOML.

func (*Config) Validate

func (c *Config) Validate() error

Validate returns an error if the config is invalid.

type Options

type Options struct {
	ConfigPath string
	PIDFile    string
}

Options represents the command line options that can be parsed.

func (*Options) GetConfigPath

func (opt *Options) GetConfigPath() string

GetConfigPath returns the config path from the options. It will return a path by searching in this order:

  1. The CLI option in ConfigPath
  2. The environment variable ENGINE_CONFIG_PATH
  3. The first emailsender.toml file on the path: - ~/.emailsender - /etc/emailsender

type PrintConfigCommand

type PrintConfigCommand struct {
	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer
}

PrintConfigCommand represents the command executed by "emailworker config".

func NewPrintConfigCommand

func NewPrintConfigCommand() *PrintConfigCommand

NewPrintConfigCommand return a new instance of PrintConfigCommand.

func (*PrintConfigCommand) Run

func (cmd *PrintConfigCommand) Run(args ...string) error

Run parses and prints the current config loaded.

Jump to

Keyboard shortcuts

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