server

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2018 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Config      Config
	GlobalEnvs  map[string]string
	Watcher     *gitwatch.Session
	SelfWatcher *gitwatch.Session
	Vault       *api.Client
	Auth        transport.AuthMethod
	// contains filtered or unexported fields
}

App stores application state

func Initialise

func Initialise(config Config) (app *App, err error)

Initialise creates a new instance and prepares it for starting

func (*App) Run added in v1.0.0

func (app *App) Run() (err error)

Run will run the application and block until graceful exit like `app.Start` but this function returns an explicit error. This is for use when Machinehead is being used as a library instead of a command line application.

func (*App) Start

func (app *App) Start() int

Start will start the application and block until graceful exit or fatal error returns an exit code to be passed back to the `main` caller for `os.Exit`.

func (*App) Stop

func (app *App) Stop()

Stop gracefully closes the application

type Config

type Config struct {
	Targets        []string `required:"true"   json:"targets"`
	CheckInterval  Duration `default:"1s"      json:"check_interval"`
	CacheDirectory string   `default:"./cache" json:"cache_directory"`
	VaultAddress   string   `required:"false"  json:"vault_address"`
	VaultToken     string   `required:"false"  json:"vault_token"`
	VaultNamespace string   `required:"false"  json:"vault_namespace"`
}

Config defines configuration fields

func LoadConfig added in v1.0.0

func LoadConfig() (config Config, err error)

LoadConfig reads configuration from the current working directory

type Duration added in v1.0.0

type Duration time.Duration

Duration wraps time.Duration to solve config unmarshalling

func (Duration) MarshalJSON added in v1.0.0

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON marshalling for durations

func (*Duration) UnmarshalJSON added in v1.0.0

func (d *Duration) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON unmarshalling for durations

Jump to

Keyboard shortcuts

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