config

package
v0.0.0-...-c29577a Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnmarshalFromEnv

func UnmarshalFromEnv(cfg *Config, opts *UnmarshalOptions) error

Types

type Config

type Config struct {
	Server   ServerConfig
	Log      LogConfig
	Crawler  CrawlerConfig
	Database DatabaseConfig
	Cache    RedisConfig // REFACTOR: rename to CacheConfig where will be more drivers
}

type CrawlerConfig

type CrawlerConfig struct {
	Size int `env:"CRAWLER_GORS_COUNT" envDefault:"4"`
}

type DatabaseConfig

type DatabaseConfig struct {
	Host     string `env:"DATABASE_HOST"`
	Port     string `env:"DATABASE_PORT"`
	Name     string `env:"DATABASE_NAME"`
	User     string `env:"DATABASE_USER"`
	Password string `env:"DATABASE_PASSWORD"`
	Database string `env:"DATABASE_DB_NAME"`
}

type HttpsConfig

type HttpsConfig struct {
	Key  string `env:"HTTPS_KEY"`
	Cert string `env:"HTTPS_CERT"`
}

type LogConfig

type LogConfig struct {
	LogLevel string `env:"LOG_LEVEL" envDefault:"INFO"`
}

type RedisConfig

type RedisConfig struct {
	Host     string `env:"CACHE_HOST"`
	Port     string `env:"CACHE_PORT"`
	Name     string `env:"CACHE_NAME"`
	Password string `env:"CACHE_PASSWORD"`
	Database int    `env:"CACHE_DB_NAME"`
}

type ServerConfig

type ServerConfig struct {
	Host string `env:"SERVER_HOST" envDefault:"localhost"`
	Port string `env:"SERVER_PORT" envDefault:"8000"`

	Https HttpsConfig
	Cors  bool `env:"ENABLE_CORS" envDefault:"true"`
}

type UnmarshalOptions

type UnmarshalOptions struct {
	Dev bool
}

Jump to

Keyboard shortcuts

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