config

package
v0.0.0-...-ffaedda Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2022 License: Apache-2.0, MIT Imports: 3 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 {
	EventPollingPeriod time.Duration `envconfig:"EVENT_POLLING_PERIOD" default:"200ms"`

	Health   HealthConfig `envconfig:"HEALTH"`
	Stream   StreamConfig `envconfig:"STREAM"`
	Database DBConfig     `envconfig:"DB"`
}

Config represents service configurations.

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig returns parsed from environment variables service configuration.

type DBConfig

type DBConfig struct {
	Host     string `envconfig:"HOST"`
	Port     int    `envconfig:"PORT" default:"5432"`
	Name     string `envconfig:"NAME" default:"payments"`
	User     string `envconfig:"USER"`
	Password string `encconfig:"PASSWORD"`

	Pool *PoolConfig `envconfig:"POOL"`
}

DBConfig represents database connection configuration.

type HealthConfig

type HealthConfig struct {
	Port          int           `envconfig:"PORT" default:"6062"`
	LiveEndpoint  string        `envconfig:"LIVINESS_ENDPOINT" default:"/livez"`
	ReadyEndpoint string        `envconfig:"READINESS_ENDPOINT" default:"/ready"`
	Period        time.Duration `envconfig:"PERIOD" default:"3s"`
	GracePeriod   time.Duration `envconfig:"GRACE_PERIOD" default:"30s"`
}

HealthConfig represents health controller configuration.

type PoolConfig

type PoolConfig struct {
	MaxOpenConns int `envconfig:"MAX_OPEN_CONNS" default:"20"`
	MaxIdleConns int `envconfig:"MAX_IDLE_CONNS" default:"20"`
}

PoolConfig represents databese connection pool configuration.

type StreamConfig

type StreamConfig struct {
	Host string `envconfig:"HOST"`
	Port int    `envconfig:"PORT" default:"6379"`
}

StreamConfig represents stream connection configuration.

func (StreamConfig) Addr

func (c StreamConfig) Addr() string

Jump to

Keyboard shortcuts

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