config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const Prefix = "otter"

All environment variables will have this prefix unless otherwise defined in struct tags. For example, the conf.LogLevel environment variable will be OTTER_LOG_LEVEL because of this prefix and the split_words struct tag in the conf below.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Maintenance bool                `default:"false" desc:"if true, the node will start in maintenance mode"`
	LogLevel    logger.LevelDecoder `split_words:"true" default:"info" desc:"specify the verbosity of logging (trace, debug, info, warn, error, fatal panic)"`
	ConsoleLog  bool                `split_words:"true" default:"false" desc:"if true logs colorized human readable output instead of json"`
	Server      ServerConfig
	Replica     ReplicaConfig
	Web         WebConfig
	// contains filtered or unexported fields
}

Config contains all of the configuration parameters for an otterdb instance and is loaded from the environment or a configuration file with reasonable defaults for values that are omitted. The Config should be validated in preparation for running the otterdb instance to ensure that all server operations work as expected.

func New

func New() (conf Config, err error)

func (Config) GetLogLevel

func (c Config) GetLogLevel() zerolog.Level

func (Config) IsZero

func (c Config) IsZero() bool

Returns true if the config has not been correctly processed from the environment.

func (Config) Validate

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

Custom validations are added here, particularly validations that require one or more fields to be processed before the validation occurs. NOTE: ensure that all nested config validation methods are called here.

type ReplicaConfig

type ReplicaConfig struct {
	Maintenance bool   `env:"OTTER_MAINTENANCE" desc:"if true sets the replica to maintenance mode; inherited from parent"`
	Enabled     bool   `default:"false" desc:"if false, the replica service will not be started, e.g. run as a single node cluster"`
	BindAddr    string `default:":2204" split_words:"true" desc:"the ip address and port to bind the replica server on"`
}

func (ReplicaConfig) Validate added in v0.2.0

func (c ReplicaConfig) Validate() error

type ServerConfig

type ServerConfig struct {
	Maintenance bool   `env:"OTTER_MAINTENANCE" desc:"if true sets the server to maintenance mode; inherited from parent"`
	Enabled     bool   `default:"true" desc:"if false, the client facing server will not be started, e.g. to uses this as a backup replica only"`
	BindAddr    string `default:":2202" split_words:"true" desc:"the ip address and port to bind the database server on"`
}

func (ServerConfig) Validate added in v0.2.0

func (c ServerConfig) Validate() error

type WebConfig

type WebConfig struct {
	Maintenance bool   `env:"OTTER_MAINTENANCE" desc:"if true sets the web ui to maintenance mode; inherited from parent"`
	Enabled     bool   `default:"false" desc:"set this to true to enable the web ui for the  database (opt-in)"`
	Mode        string `default:"release" desc:"specify the mode of the web server (release, debug, test)"`
	BindAddr    string `default:":2208" split_words:"true" desc:"the ip address and port to bind the web server on"`
	Origin      string `` /* 140-byte string literal not displayed */
}

func (WebConfig) Validate added in v0.2.0

func (c WebConfig) Validate() (err error)

Jump to

Keyboard shortcuts

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