infra

package
v0.0.0-...-0b5492d Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDB

func NewDB(cfg DbConfig) *sqlx.DB

NewDB creates a new postgres database connection. It should receive database connection configuration but for the demo purposes we will ignore it

func Start

func Start(ctx context.Context, lock *latch.CountDownLatch, cfg Config)

Types

type Config

type Config struct {
	WebConfig
	DbConfig
	OutboxHeartbeat time.Duration `env:"OUTBOX_HEARTBEAT" envDefault:"5s"`
}

func LoadEnvVars

func LoadEnvVars() Config

type DbConfig

type DbConfig struct {
	DbName     string `env:"DB_NAME" envDefault:"postgres"`
	DbHost     string `env:"DB_HOST" envDefault:"localhost"`
	DbPort     int    `env:"DB_PORT" envDefault:"5432"`
	DbUser     string `env:"DB_USER" envDefault:"postgres"`
	DbPassword string `env:"DB_PASSWORD" envDefault:"secret"`
}

type WebConfig

type WebConfig struct {
	Port string `env:"PORT" envDefault:":8080"`
}

Directories

Path Synopsis
controller
web
gateway

Jump to

Keyboard shortcuts

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