config

package
v0.0.0-...-9e87bf8 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: MIT Imports: 4 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 {
	Server
	PostgreSQL
	Process
}

Config is the configuration for the application

func Load

func Load() *Config

Load loads the configuration from environment variables

type PostgreSQL

type PostgreSQL struct {
	Driver          string `env:"DB_DRIVER" envDefault:"postgres"`
	Host            string `env:"DB_HOST" envDefault:"localhost"`
	Port            string `env:"DB_PORT" envDefault:"5432"`
	Database        string `env:"DB_DATABASE" envDefault:"enlabs_test_service"`
	Username        string `env:"DB_USERNAME" envDefault:"enlabs_test_service"`
	Password        string `env:"DB_PASSWORD" envDefault:"enlabs_test_service"`
	SSLMode         string `env:"DB_SSLMODE" envDefault:"disable"`
	MaxConnAttempts string `env:"DB_MAX_CONN_ATTEMPTS" envDefault:"5"`
}

PostgreSQL is the configuration for the database

func (PostgreSQL) DSN

func (c PostgreSQL) DSN() string

DSN returns the DSN for the database

type Process

type Process struct {
	Interval string `env:"PROCESS_INTERVAL" envDefault:"10"`
}

type Server

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

Server is the configuration for the server

func (Server) Addr

func (s Server) Addr() string

Addr returns the address for the server

Jump to

Keyboard shortcuts

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