config

package
v3.50.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2021 License: MIT Imports: 4 Imported by: 14

Documentation

Overview

Package config contains utilities for reading and parsing service configuration files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetInferenceCandidates

func GetInferenceCandidates(raw interface{}, ignoreFields ...string) []string

GetInferenceCandidates checks a generic config structure (YAML or JSON) and, if an explicit type value is not found, returns a list of candidate types by walking the root objects field names.

func MarshalYAML

func MarshalYAML(v interface{}) ([]byte, error)

MarshalYAML marshals a structure into YAML with consistent formatting across all Benthos components.

Types

type SanitForYAML

type SanitForYAML map[string]interface{}

SanitForYAML a map to be embedded within a parent object for YAML marshalling.

type Sanitised

type Sanitised map[string]interface{}

Sanitised is a general map[string]interface{} type that tries to marshal into both YAML and JSON in a way that ensure the 'type' field is always first.

func SanitizeComponent added in v3.33.0

func SanitizeComponent(conf interface{}) (Sanitised, error)

SanitizeComponent performs a generic sanitation on a component config, where a type field describes the type of the component, and the only other fields returned in the sanitized result are under the namespace of the type.

func (Sanitised) MarshalJSON

func (s Sanitised) MarshalJSON() ([]byte, error)

MarshalJSON return the config as a JSON blob with the 'type' field first.

func (Sanitised) MarshalYAML

func (s Sanitised) MarshalYAML() (interface{}, error)

MarshalYAML return the config as YAML with the 'type' field first.

Jump to

Keyboard shortcuts

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