configuration

package
v0.0.0-...-308d6b8 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2021 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIConfig

type APIConfig struct {
	AppName string `envconfig:"APP_NAME" default:"simple-bank"`
	Port    string `envconfig:"API_PORT" default:"3000"`
}

type Config

type Config struct {
	API APIConfig

	//Storage
	Postgres PostgresConfig
}

func LoadConfig

func LoadConfig() (*Config, error)

func (Config) DSN

func (c Config) DSN() string

func (Config) URL

func (c Config) URL() string

type PostgresConfig

type PostgresConfig struct {
	DatabaseName          string `envconfig:"DATABASE_NAME" default:"simple_bank_db"`
	User                  string `envconfig:"DATABASE_USER" default:"postgres"`
	Password              string `envconfig:"DATABASE_PASSWORD" default:"postgres"`
	Host                  string `envconfig:"DATABASE_HOST_DIRECT" default:"localhost"`
	Port                  string `envconfig:"DATABASE_PORT_DIRECT" default:"5432"`
	PoolMinSize           string `envconfig:"DATABASE_POOL_MIN_SIZE" default:"2"`
	PoolMaxSize           string `envconfig:"DATABASE_POOL_MAX_SIZE" default:"10"`
	PoolMaxConnLifetime   string `envconfig:"DATABASE_POOL_MAX_CONN_LIFETIME"`
	PoolMaxConnIdleTime   string `envconfig:"DATABASE_POOL_MAX_CONN_IDLE_TIME"`
	PoolHealthCheckPeriod string `envconfig:"DATABASE_POOL_HEALTHCHECK_PERIOD"`
	SSLMode               string `envconfig:"DATABASE_SSLMODE" default:"disable"`
	SSLRootCert           string `envconfig:"DATABASE_SSL_ROOTCERT"`
	SSLCert               string `envconfig:"DATABASE_SSL_CERT"`
	SSLKey                string `envconfig:"DATABASE_SSL_KEY"`
	Hostname              string `envconfig:"HOSTNAME" default:"localhost"`
}

Jump to

Keyboard shortcuts

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