config

package
v1.14.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2019 License: MIT Imports: 19 Imported by: 2

Documentation

Overview

Package config defines the full configuration structure used by the Benthos service, including methods of normalising and linting user configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddExamples

func AddExamples(conf *Type, examples ...string)

AddExamples takes a configuration struct and a variant list of type names to add to it and injects those types appropriately.

For example, your variant arguments could be "kafka" and "amqp", which case this function will create a configuration that reads from Kafka and writes over AMQP.

func Lint

func Lint(rawBytes []byte, config Type) ([]string, error)

Lint attempts to report errors within a user config. Returns a slice of lint results.

func Read

func Read(path string, replaceEnvs bool, config *Type) ([]string, error)

Read will attempt to read a configuration file path into a structure. Returns an array of lint messages or an error.

Types

type SanitisedConfig

type SanitisedConfig struct {
	HTTP               interface{} `json:"http" yaml:"http"`
	Input              interface{} `json:"input" yaml:"input"`
	Buffer             interface{} `json:"buffer" yaml:"buffer"`
	Pipeline           interface{} `json:"pipeline" yaml:"pipeline"`
	Output             interface{} `json:"output" yaml:"output"`
	Manager            interface{} `json:"resources" yaml:"resources"`
	Logger             interface{} `json:"logger" yaml:"logger"`
	Metrics            interface{} `json:"metrics" yaml:"metrics"`
	Tracer             interface{} `json:"tracer" yaml:"tracer"`
	SystemCloseTimeout interface{} `json:"shutdown_timeout" yaml:"shutdown_timeout"`
}

SanitisedConfig is a config struct of generic types, this is returned by Sanitised() and is a generic structure containing only fields of relevance.

type Type

type Type struct {
	HTTP               api.Config `json:"http" yaml:"http"`
	stream.Config      `json:",inline" yaml:",inline"`
	Manager            manager.Config `json:"resources" yaml:"resources"`
	Logger             log.Config     `json:"logger" yaml:"logger"`
	Metrics            metrics.Config `json:"metrics" yaml:"metrics"`
	Tracer             tracer.Config  `json:"tracer" yaml:"tracer"`
	SystemCloseTimeout string         `json:"shutdown_timeout" yaml:"shutdown_timeout"`
}

Type is the Benthos service configuration struct.

func New

func New() Type

New returns a new configuration with default values.

func (Type) Sanitised

func (c Type) Sanitised() (*SanitisedConfig, error)

Sanitised returns a sanitised copy of the Benthos configuration, meaning fields of no consequence (unused inputs, outputs, processors etc) are excluded.

Jump to

Keyboard shortcuts

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