config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2022 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 {
	Postgres   PostgresConfig
	HTTPServer HTTPServerConfig
	Jwt        JwtConfig
	Dockertest DockertestConfig
	Redis      RedisConfig
}

func ReadConfig

func ReadConfig(filename string) *Config

func ReadConfigFromEnv

func ReadConfigFromEnv() *Config

func ReadConfigFromFile

func ReadConfigFromFile(filename string) *Config

type DockertestConfig

type DockertestConfig struct {
	Timeout string `env:"DOCKERTEST_TIMEOUT" env-default:"30"`
}

type HTTPServerConfig

type HTTPServerConfig struct {
	Host string `env:"SERVER_HOST" env-default:"localhost"`
	Port string `env:"SERVER_PORT" env-default:"8080"`
}

func (HTTPServerConfig) HostAndPort

func (cfg HTTPServerConfig) HostAndPort() string

func (HTTPServerConfig) ServerPort

func (cfg HTTPServerConfig) ServerPort() string

type JwtConfig

type JwtConfig struct {
	Secret  string `env:"JWT_SECRET" env-default:"BAD_SECRET"`
	Timeout string `env:"JWT_TIMEOUT" env-default:"30"`
}

type PostgresConfig

type PostgresConfig struct {
	User     string `env:"DATABASE_USER" env-default:"postgres"`
	Password string `env:"DATABASE_PASSWORD" env-default:"good-password"`
	Host     string `env:"DATABASE_HOST" env-default:"localhost"`
	Port     string `env:"DATABASE_PORT" env-default:"5432"`
	Instance string `env:"DATABASE_NAME" env-default:"suricate"`
}

func (PostgresConfig) URL

func (cfg PostgresConfig) URL() string

type RedisConfig

type RedisConfig struct {
	Host              string `env:"REDIS_HOST" env-default:"localhost"`
	Port              string `env:"REDIS_PORT" env-default:"6379"`
	IdempotencyKeyTTL string `env:"IDEMPOTENCY_TTL" env-default:"86400"`
}

func (RedisConfig) URL

func (cfg RedisConfig) URL() string

Jump to

Keyboard shortcuts

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