config

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package config provides settings and configuration for the whipser server by loading the configuration from the environment and specifying reasonable defaults and required settings.

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"`
	Mode         string          `split_words:"true" default:"debug"`
	BindAddr     string          `split_words:"true" required:"false"`
	LogLevel     LogLevelDecoder `split_words:"true" default:"info"`
	ConsoleLog   bool            `split_words:"true" default:"false"`
	AllowOrigins []string        `split_words:"true" default:"https://whisper.rotational.dev"`
	Google       GoogleConfig
	// contains filtered or unexported fields
}

Config uses envconfig to load required settings from the environment and validate them in preparation for running the whisper service.

func New

func New() (_ Config, err error)

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

func (Config) GetLogLevel

func (c Config) GetLogLevel() zerolog.Level

func (Config) IsZero

func (c Config) IsZero() bool

func (Config) Validate added in v1.1.1

func (c Config) Validate() error

type GoogleConfig added in v1.1.1

type GoogleConfig struct {
	Credentials string `envconfig:"GOOGLE_APPLICATION_CREDENTIALS" required:"false"`
	Project     string `envconfig:"GOOGLE_PROJECT_NAME" required:"true"`
	Testing     bool   `split_words:"true" default:"false"`
}

type LogLevelDecoder

type LogLevelDecoder zerolog.Level

LogLevelDecoder deserializes the log level from a config string.

func (*LogLevelDecoder) Decode

func (ll *LogLevelDecoder) Decode(value string) error

Decode implements envconfig.Decoder

Jump to

Keyboard shortcuts

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