config

package
v0.0.1-0...-a0864a0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// EnvPrismConfigDir is Environment Variable that points to the configuration directory (default: ./config)
	EnvPrismConfigDir = Env{
						// contains filtered or unexported fields
	}

	// EnvPrismDataDir is Environment Variable that points to the configuration directory (default: ./config)
	EnvPrismDataDir = Env{
					// contains filtered or unexported fields
	}

	// EnvPrism is Environment Variable that represents either prod or dev environment
	EnvPrism = Env{
				// contains filtered or unexported fields
	}
)
View Source
var DefaultAppConfig = App{
	Logger: "prod",
}

DefaultAppConfig used in defaults

View Source
var DefaultComponent = Component{
	Concurrency: runtime.NumCPU(),
}

DefaultComponent used in defaults

View Source
var DefaultInput = Input{
	Component: DefaultComponent,
}

DefaultInput used in defaults

View Source
var DefaultNode = Node{
	Async: false,
}

DefaultNode used in defaults

View Source
var DefaultOutput = Output{
	Component: DefaultComponent,
}

DefaultOutput used in defaults

View Source
var DefaultPipeline = Pipeline{
	Concurrency: runtime.NumCPU(),
}

DefaultPipeline used in defaults

View Source
var DefaultProcessor = Processor{
	Component: DefaultComponent,
}

DefaultProcessor used in defaults

Functions

func Load

func Load(filePath string, out WithDefaults, resolveEnv bool) (hash string, err error)

Load loads a .yaml file into out. resolveEnv will replace ${ENV_VAR} with value of env variable "ENV_VAR"

func RecursivelyTurnYAMLMaps

func RecursivelyTurnYAMLMaps(in interface{}) interface{}

RecursivelyTurnYAMLMaps turns nested YAML maps from map[interface{}]interface{} to map[string]interface{} inspired by solutions in https://github.com/go-yaml/yaml/issues/139 especially elastic's #issuecomment-183937598

Types

type App

type App struct {
	Logger string `yaml:"logger"`
}

App used for YAML decoding

func (*App) ApplyDefault

func (n *App) ApplyDefault() error

ApplyDefault func used in defaults

type Component

type Component struct {
	Plugin      string                 `yaml:"plugin"`
	Concurrency int                    `yaml:"concurrency"`
	Config      map[string]interface{} `yaml:"config"`
}

Component used for YAML decoding

type Components

type Components struct {
	Inputs     Inputs
	Processors Processors
	Outputs    Outputs
}

type Config

type Config struct {
	App        App
	Components Components
	Pipelines  Pipelines
	Logger     zap.SugaredLogger
}

Config is the collection of config needed for the engine to start.

type Env

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

Env An Environment Variable Config

func (*Env) Lookup

func (e *Env) Lookup() string

Lookup Get the environment variable and evaluate it

func (*Env) Name

func (e *Env) Name() string

Name Get the NAME of the environment variable

type Input

type Input struct {
	Component `yaml:",inline" mapstructure:",squash"`
}

Input used for YAML decoding

func (*Input) ApplyDefault

func (i *Input) ApplyDefault() error

ApplyDefault func used in defaults

type Inputs

type Inputs struct {
	Inputs map[string]*Input `yaml:"inputs"`
}

inputs used for YAML decoding

func (*Inputs) ApplyDefault

func (i *Inputs) ApplyDefault() error

ApplyDefault func used in defaults

type Node

type Node struct {
	Async bool             `yaml:"async"`
	Next  map[string]*Node `yaml:",inline"`
}

Node is a single node in a pipeline

func (*Node) ApplyDefault

func (n *Node) ApplyDefault() error

ApplyDefault func used in defaults

type Output

type Output struct {
	Component `yaml:",inline" mapstructure:",squash"`
}

Output used for YAML decoding

func (*Output) ApplyDefault

func (o *Output) ApplyDefault() error

ApplyDefault func used in defaults

type Outputs

type Outputs struct {
	Outputs map[string]*Output `yaml:"outputs"`
}

outputs used for YAML decoding

func (*Outputs) ApplyDefault

func (i *Outputs) ApplyDefault() error

ApplyDefault func used in defaults

type Pipeline

type Pipeline struct {
	Concurrency int              `yaml:"concurrency"`
	Pipeline    map[string]*Node `yaml:"pipeline"`
}

Pipelines used for YAML decoding

func (*Pipeline) ApplyDefault

func (p *Pipeline) ApplyDefault() error

ApplyDefault func used in defaults

type Pipelines

type Pipelines struct {
	Pipelines map[string]*Pipeline `yaml:"pipelines"`
	Hash      string
}

Pipelines used for YAML decoding

func (*Pipelines) ApplyDefault

func (i *Pipelines) ApplyDefault() error

ApplyDefault func used in defaults

type Processor

type Processor struct {
	Component `yaml:",inline" mapstructure:",squash"`
}

Processor used for YAML decoding

func (*Processor) ApplyDefault

func (p *Processor) ApplyDefault() error

ApplyDefault func used in defaults

type Processors

type Processors struct {
	Processors map[string]*Processor `yaml:"processors"`
}

Processors used for YAML decoding

func (*Processors) ApplyDefault

func (i *Processors) ApplyDefault() error

ApplyDefault func used in defaults

type WithDefaults

type WithDefaults interface {
	ApplyDefault() error
}

WithDefaults interface is the interface for default values

Jump to

Keyboard shortcuts

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