config

package
v0.0.0-...-8b6722b Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	Env AppEnv `env:"ENV" envDefault:"Development"`
}

func (AppConfig) Validate

func (appConfig AppConfig) Validate() error

type Config

type Config struct {
	App    AppConfig         `envPrefix:"APP_"`
	Server ServerConfig      `envPrefix:"SERVER_"`
	Db     db.DbConfig       `envPrefix:"DB_"`
	Redis  redis.RedisConfig `envPrefix:"REDIS_"`
	Auth   auth.AuthConfig   `envPrefix:"AUTH_"`
}

func (Config) Validate

func (config Config) Validate() error

type ConfigService

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

func NewConfigService

func NewConfigService(logger logr.Logger) (*ConfigService, error)

func (*ConfigService) Config

func (configService *ConfigService) Config() *Config

type ConfigServicer

type ConfigServicer interface {
	Config() *Config
}

type Loader

type Loader interface {
	Load() error
}

Loader has a Load function that is called for each config struct.

type ServerConfig

type ServerConfig struct {
	Host string `env:"HOST" envDefault:"0.0.0.0"`
	Port string `env:"PORT" envDefault:"4000"`
}

func (ServerConfig) Validate

func (serverConfig ServerConfig) Validate() error

Jump to

Keyboard shortcuts

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