config

package
v0.0.0-...-eaa370e Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2015 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_STATS_PORT = ":9090"
)

Variables

View Source
var (
	DEFAULT_LUA_PATH  = os.Getenv("GOPATH") + "/src/github.com/barracudanetworks/GoWorker/lua"
	WRONG_CONFIG_TYPE = errors.New("config: wrong config type")
	LUA_PATH          = DEFAULT_LUA_PATH
)

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	ProviderConfigs        []ConfigPair
	WorkerConfigs          []ConfigPair
	FailureHanldlerConfigs []ConfigPair
	ManagerToManager       string      `json:"manager_to_manager_port"`
	StatsPort              string      `json:"stats_port"`
	LuaPath                string      `json:"lua_path"`
	RawProviders           ConfigBlock `json:"providers"`
	RawWorkers             ConfigBlock `json:"workers"`
	RawFailureHandler      ConfigBlock `json:"failure_handler"`
}

AppConfig contains all of the information needed to configure the app

func DefaultAppConfig

func DefaultAppConfig() *AppConfig

defaultAppConfig returns a app config with defaults params

func LoadAppConfigFromFile

func LoadAppConfigFromFile(fileName string) (*AppConfig, error)

LoadAppConfigFromFile loads configuration needed for the initilization of the manager

type Config

type Config json.RawMessage

Holds generic config information

func (Config) Apply

func (c Config) Apply(conf Configer) error

Apply decode the config into the given interface and call it's init function

func (Config) Encode

func (c Config) Encode(i interface{}) error

Encode endcode the given interface onto a Config struct

type ConfigBlock

type ConfigBlock []map[string]json.RawMessage

type ConfigPair

type ConfigPair struct {
	Type   string
	Config Config
}

type Configer

type Configer interface {
	ConfigStruct() interface{}
	Init(i interface{}) error
}

Configer has the ability to return a config struct and a method to apply that configuartion

Jump to

Keyboard shortcuts

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