config

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package config provides functionality to read and parse the Gordon configuration file.

Index

Constants

View Source
const DefaultConfig = "./gordon.config.toml"

DefaultConfig describes the default path to the configuration file.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	RedisNetwork   string          `toml:"redis_network"`    // network type used for the connection to Redis
	RedisAddress   string          `toml:"redis_address"`    // network address used for the connection to Redis
	RedisQueueKey  string          `toml:"queue_key"`        // first part of the list-names used in Redis
	ErrorScript    string          `toml:"error_script"`     // path to script/application that is executed when a task created an error
	FailedTasksTTL int             `toml:"failed_tasks_ttl"` // ttl for the lists that store failed tasks
	TempDir        string          `toml:"temp_dir"`         // path to a directory that is used for temporary files
	IntervalMin    int             `toml:"interval_min"`     // minimum interval for checking for new tasks
	IntervalMax    int             `toml:"interval_max"`     // maxiumum interval for checking for new tasks
	IntervalFactor float64         `toml:"interval_factor"`  // multiplicator for the task-check interval
	BackoffEnabled bool            `toml:"backoff_enabled"`  // general flag to disable/enable error-backoff
	BackoffMin     int             `toml:"backoff_min"`      // general error-backoff start value in milliseconds
	BackoffMax     int             `toml:"backoff_max"`      // general error-backoff maximum value in milliseconds
	BackoffFactor  float64         `toml:"backoff_factor"`   // general error-backoff multiplicator
	Logfile        string          // a file where all output will be written to, instead of stdout
	Stats          StatsConfig     // options for the statistics package
	Tasks          map[string]Task // map of available tasks that Gordon can execute
}

A Config stores values, necessary for the execution of Gordon.

func New

func New(path string) (c Config, err error)

New reads the provided file and returns a Config instance with the values from it. It may also return an error, when the file doesn't exist, or the content could not be parsed.

type NewRelicConfig added in v1.6.0

type NewRelicConfig struct {
	License string // the newrelic license key
	AppName string `toml:"app_name"` // the newrelic app-name
}

NewRelicConfig stores information for the agent.

type StatsConfig

type StatsConfig struct {
	Interface string         // the interface where statistics from Gordon can be gathered from
	NewRelic  NewRelicConfig // options for newrelic agent
}

StatsConfig contains configuration options for the stats-package/service.

type Task

type Task struct {
	Type           string  // second part of the list-names used in Redis and used to identify tasks
	Script         string  // path to the script/application that this task should execute
	Workers        int     // number of concurrent go-routines available for this task
	FailedTasksTTL int     `toml:"failed_tasks_ttl"` // ttl for the lists that store failed tasks
	BackoffEnabled bool    `toml:"backoff_enabled"`  // task-specific flag to disable/enable error-backoff
	BackoffMin     int     `toml:"backoff_min"`      // task specific error-backoff start value in milliseconds
	BackoffMax     int     `toml:"backoff_max"`      // task specific error-backoff maximum value in milliseconds
	BackoffFactor  float64 `toml:"backoff_factor"`   // task specific error-backoff multiplicator
}

A Task stores information that task-workers need to execute their script/application.

Jump to

Keyboard shortcuts

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