config

package
v0.0.0-...-c2aaf4c Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2021 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package config provides the functionality of managing configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	PortHTTP string `env:"PORT_HTTP,default=8081"`
	PortGRPC string `env:"PORT_GRPC,default=8080"`
	Domain   string `env:"DOMAIN,required"`
	Postgres Postgres
	Redis    Redis
}

Config holds configuration for the project.

func NewConfig

func NewConfig(env string) (*Config, error)

NewConfig creates an instance of Config. It needs the path of the env file to be used.

type Postgres

type Postgres struct {
	Host            string `env:"POSTGRES_HOST,required"`
	Port            string `env:"POSTGRES_PORT,required"`
	DBName          string `env:"POSTGRES_DBNAME,required"`
	User            string `env:"POSTGRES_USER,required"`
	Password        string `env:"POSTGRES_PASSWORD,required"`
	MaxOpenConns    int    `env:"POSTGRES_MAX_OPEN_CONNS,required"`
	MaxConnLifetime string `env:"POSTGRES_MAX_CONN_LIFETIME,required"`
}

Postgres holds configuration for PostgreSQL.

type Redis

type Redis struct {
	Address  string `env:"REDIS_ADDRESS,required"`
	Username string `env:"REDIS_USERNAME"`
	Password string `env:"REDIS_PASSWORD"`
}

Redis holds configuration for the redis.

Jump to

Keyboard shortcuts

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