env

package
v0.0.0-...-49abefd Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package env aggregates configuration models that are used by the application. Their values come from the current environment

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DatabaseConfig

type DatabaseConfig struct {
	Port            int    `env:"DB_PORT,default=3306"`
	User            string `env:"DB_USER,default=admin"`
	Password        string `env:"DB_PW,default=admin"`
	Host            string `env:"DB_HOST,default=localhost"`
	Name            string `env:"DB_NAME,default=stn_accounts"`
	Driver          string `env:"DB_DRIVER,default=mysql"`
	MaxOpenConns    int    `env:"DB_MAX_OPEN_CONNS,default=10"`
	MaxIdleConns    int    `env:"DB_MAX_IDLE_CONNS,default=10"`
	ConnMaxLifetime int    `env:"DB_CONN_MAX_LIFETIME,default=0"`
	ParseTime       bool   `env:"DB_PARSE_TIME,default=true"`
}

DatabaseConfig maintains the database connection settings

func NewDatabaseConfig

func NewDatabaseConfig(ctx *context.Context) DatabaseConfig

NewDatabaseConfig retrives the environment settings related to the Rest API

func (*DatabaseConfig) DataSourceName

func (c *DatabaseConfig) DataSourceName() string

DataSourceName builds a datasource name by concatenating the props

type RestConfig

type RestConfig struct {
	Port            int    `env:"PORT,default=3000"`
	Secret          []byte `env:"JWT_SECRET,default=rest-app@@secret"`
	TokenExpTimeout int    `env:"JWT_EXP_TIMEOUT,default=30"`
}

RestConfig maintains the configuration for the Rest API

func NewRestConfig

func NewRestConfig(ctx *context.Context) RestConfig

NewRestConfig retrives the environment settings related to the Rest API

Jump to

Keyboard shortcuts

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