config

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Maintenance    bool                `split_words:"true" default:"false"`
	BindAddr       string              `split_words:"true" default:":4436"`
	MetricsAddr    string              `split_words:"true" default:":7777"`
	MetricsEnabled bool                `split_words:"true" default:"true"`
	LogLevel       logger.LevelDecoder `split_words:"true" default:"info"`
	ConsoleLog     bool                `split_words:"true" default:"false"`
	Database       DatabaseConfig
	Replica        ReplicaConfig
	// contains filtered or unexported fields
}

Config defines the struct that is expected to initialize the trtl server Note: because we need to validate the configuration, `config.New()` must be called to ensure that the `processed` is correctly set

func New

func New() (_ Config, err error)

New creates a new Config object, loading environment variables and defaults.

func (Config) GetHonuConfig

func (c Config) GetHonuConfig() honuconfig.ReplicaConfig

GetHonuConfig converts ReplicaConfig into honu's struct of the same name.

func (Config) GetLogLevel

func (c Config) GetLogLevel() zerolog.Level

func (Config) IsZero

func (c Config) IsZero() bool

func (Config) Mark

func (c Config) Mark() (Config, error)

Mark a manually constructed as processed as long as it is validated.

func (Config) Validate

func (c Config) Validate() (err error)

type DatabaseConfig

type DatabaseConfig struct {
	URL           string `split_words:"true" required:"true"`
	ReindexOnBoot bool   `split_words:"true" default:"false"`
}

type ReplicaConfig

type ReplicaConfig struct {
	Enabled        bool          `split_words:"true" default:"true"`
	PID            uint64        `split_words:"true" required:"false"`
	Region         string        `split_words:"true" required:"false"`
	Name           string        `split_words:"true" required:"false"`
	GossipInterval time.Duration `split_words:"true" default:"1m"`
	GossipSigma    time.Duration `split_words:"true" default:"5s"`
}

func (ReplicaConfig) Validate

func (c ReplicaConfig) Validate() error

Jump to

Keyboard shortcuts

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