config

package
v0.4.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cfg = &Config{}

Cfg is the global config

Functions

This section is empty.

Types

type Auth added in v0.3.0

type Auth struct {
	Enabled bool   `mapstructure:"enabled"`
	Type    string `mapstructure:"type"`
}

type Config

type Config struct {
	Server Server `mapstructure:"server"`

	Data struct {
		Database struct {
			DSN string `mapstructure:"dsn"`
		} `mapstructure:"database"`
	} `mapstructure:"data"`

	Daemons struct {
		Compaction struct {
			CronSchedule string `mapstructure:"cron"`
		} `mapstructure:"compaction"`
		ProtoParsing struct {
			CronSchedule string `mapstructure:"cron"`
		} `mapstructure:"protoparsing"`
	} `mapstructure:"daemons"`
}

type Loader

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

Loader is the config loader

func NewLoader

func NewLoader() *Loader

NewLoader creates a new Loader instance.

func (*Loader) MustLoad

func (loader *Loader) MustLoad()

MustLoad loads the config from the config file and environment variables

type Server added in v0.3.0

type Server struct {
	HTTP struct {
		Addr    string        `mapstructure:"addr"`
		Timeout time.Duration `mapstructure:"timeout"`
		Auth    Auth          `mapstructure:"auth"`
	} `mapstructure:"http"`
	GRPC struct {
		Addr    string        `mapstructure:"addr"`
		Timeout time.Duration `mapstructure:"timeout"`
		TLS     struct {
			Enabled  bool   `mapstructure:"enabled"`
			CertFile string `mapstructure:"certFile"`
			KeyFile  string `mapstructure:"keyFile"`
		} `mapstructure:"tls"`
		Auth Auth `mapstructure:"auth"`
	} `mapstructure:"grpc"`
	Debug struct {
		Addr    string        `mapstructure:"addr"`
		Timeout time.Duration `mapstructure:"timeout"`
	} `mapstructure:"debug"`
}

Jump to

Keyboard shortcuts

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