config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConfigNotValid = fmt.Errorf("configuration not valid")
)

Functions

func GetConfig

func GetConfig[T Validator](config GenericConfig) (T, error)

Types

type Authentication

type Authentication struct {
	Secret SecretSource `json:"secret"`
}

type Configuration

type Configuration struct {
	Integrations []Integration `json:"integrations"`
}

func LoadServiceConfiguration

func LoadServiceConfiguration(filePath string) (*Configuration, error)

type EnvironmentVariables

type EnvironmentVariables struct {
	LogLevel             string `env:"LOG_LEVEL" envDefault:"info"`
	HTTPPort             string `env:"HTTP_PORT" envDefault:"8080"`
	HTTPAddress          string `env:"HTTP_ADDRESS" envDefault:"0.0.0.0"`
	ServicePrefix        string `env:"SERVICE_PREFIX"`
	DelayShutdownSeconds int    `env:"DELAY_SHUTDOWN_SECONDS" envDefault:"10"`

	ConfigurationPath string `env:"CONFIGURATION_PATH,required"`
}

EnvironmentVariables struct with the mapping of desired environment variables.

type GenericConfig

type GenericConfig struct {
	Type string `json:"type"`

	Raw []byte `json:"-"`
}

func (*GenericConfig) UnmarshalJSON

func (w *GenericConfig) UnmarshalJSON(data []byte) error

type Integration

type Integration struct {
	Source    GenericConfig `json:"source"`
	Pipelines []Pipeline    `json:"pipelines"`
}

type Pipeline

type Pipeline struct {
	Processors Processors `json:"processors"`
	Sinks      Sinks      `json:"sinks"`
}

type Processors

type Processors []GenericConfig

type SecretSource

type SecretSource string

func (SecretSource) String

func (s SecretSource) String() string

func (*SecretSource) UnmarshalJSON

func (s *SecretSource) UnmarshalJSON(data []byte) error

type Sinks

type Sinks []GenericConfig

type Source

type Source GenericConfig

type Validator

type Validator interface {
	Validate() error
}

Jump to

Keyboard shortcuts

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