config

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2018 License: MIT Imports: 11 Imported by: 7

Documentation

Index

Constants

View Source
const (
	YML_CFG_KEY_SYS  = "global.system"
	YML_CFG_KEY_COMP = "global.components"
	YML_CFG_KEY_PPL  = "global.pipeline"
)

Variables

This section is empty.

Functions

func Get

func Get(key string) (interface{}, bool)

func GetAll

func GetAll() map[string]interface{}

func GetOrDefault

func GetOrDefault(key string, def interface{}) (interface{}, bool)

func Register

func Register(key string, prov Provider) error

func Resolve

func Resolve() error

Types

type CfgBlockComponent

type CfgBlockComponent struct {
	Module      string
	Plugin      string
	Constructor string
	Params      map[string]interface{}
}

type CfgBlockPipeline

type CfgBlockPipeline struct {
	Links   []string
	Connect string
	Routes  map[string]string
}

type CfgBlockSystem

type CfgBlockSystem struct {
	Maxprocs int
	Admin    CfgBlockSystemAdmin
}

type CfgBlockSystemAdmin

type CfgBlockSystemAdmin struct {
	Enabled  bool
	BindAddr string `yaml:"bind_addr"`
}

type HttpJsonOpt

type HttpJsonOpt uint32
const (
	HttpJsonOptPeriodic HttpJsonOpt = 1 << iota
)

type HttpJsonProv

type HttpJsonProv struct {
	// contains filtered or unexported fields
}

func RegisterHttpJsonProv

func RegisterHttpJsonProv(cfgPath string, fetchUrl string,
	container interface{}, opts HttpJsonOpt) (*HttpJsonProv, error)

func (*HttpJsonProv) DependsOn

func (hjp *HttpJsonProv) DependsOn() []string

func (*HttpJsonProv) GetName

func (hjp *HttpJsonProv) GetName() string

func (*HttpJsonProv) GetOptions

func (hjp *HttpJsonProv) GetOptions() ProviderOptions

func (*HttpJsonProv) GetValue

func (hjp *HttpJsonProv) GetValue(key string) (interface{}, bool)

func (*HttpJsonProv) GetWeight

func (hjp *HttpJsonProv) GetWeight() uint32

func (*HttpJsonProv) Resolve

func (hjp *HttpJsonProv) Resolve() error

func (*HttpJsonProv) Setup

func (hjp *HttpJsonProv) Setup() error

type Provider

type Provider interface {
	Setup() error
	DependsOn() []string
	Resolve() error
	GetName() string
	GetWeight() uint32
	GetOptions() ProviderOptions
	GetValue(string) (interface{}, bool)
}

type ProviderOptions

type ProviderOptions uint64
const (
	ProviderOptionsFileCache ProviderOptions = 1 << iota
	ProviderOptionsTrustOldCache
)

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

type YAMLConfig

type YAMLConfig struct {
	System     *CfgBlockSystem
	Components map[string]CfgBlockComponent
	Pipeline   map[string]CfgBlockPipeline
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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