config

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StringJSONArrayOrSlicesToConfig

func StringJSONArrayOrSlicesToConfig() func(f reflect.Kind, t reflect.Kind, data interface{}) (interface{}, error)

StringJSONArrayOrSlicesToConfig will convert Json Encoded Strings to Maps or Slices, Used Primarily to support Slices and Maps in Environment variables

Types

type AutoIndexPattern

type AutoIndexPattern struct {
	Enabled         bool
	GeneralPatterns []GeneralPattern
	Schedule        string `validate:"required"`
	Concurrency     int    `validate:"gt=0"`
}

AutoIndexPattern for Config Unmarshalling

type Config

type Config struct {
	Kibana              Kibana  `validate:"required"`
	Logging             Logging `validate:"required"`
	AutoIndexPattern    AutoIndexPattern
	RefreshIndexPattern RefreshIndexPattern
}

Config for Config Unmarshalling

func Default

func Default() *Config

Default Return App Default Config

func Load

func Load(configName string) (*Config, error)

Load Load Configuration from All Sources, starting

1- Environment Variables.	(ex: RUBBAN_KIBANA_HOST=https://kibana:5601"
2- .env file.
3- rubban.(yaml|yml|json|toml)
(values from the earlier overwrite the latter).

type GeneralPattern

type GeneralPattern struct {
	Pattern       string `validate:"required"`
	TimeFieldName string
}

GeneralPattern for Config Unmarshalling

type Kibana

type Kibana struct {
	Host     string `validate:"required,uri"`
	User     string `validate:"required_with=password"`
	Password string `validate:"required_with=User"`
}

Kibana for Config Unmarshalling

type Logging

type Logging struct {
	Level  string `validate:"required,oneof=debug info warn fatal panic"`
	Format string `validate:"required,oneof=console json logfmt"`
	Debug  bool
	Color  bool
}

Logging for Config Unmarshalling

type RefreshIndexPattern added in v0.3.0

type RefreshIndexPattern struct {
	Enabled     bool
	Patterns    []string
	Schedule    string `validate:"required"`
	Concurrency int    `validate:"gt=0"`
}

RefreshIndexPattern for Config Unmarshalling

Jump to

Keyboard shortcuts

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