settings

package
v0.0.0-...-c3f22ab Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//SecretFilename file to get keys and configurations
	SecretFilename = "secrets"
	//DatabasePath to read database configurations
	DatabasePath = "database"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppSettings

type AppSettings struct {
	Generic  GenericSettings
	Database DatabaseSettings
}

AppSettings contains application related settings

func GetSettings

func GetSettings() *AppSettings

GetSettings retrieves the application settings

type DatabaseSettings

type DatabaseSettings struct {
	Host           string `mapstructure:"host" default:"localhost"`
	Port           string `mapstructure:"port" default:"5432"`
	User           string `mapstructure:"user" validate:"required"`
	Name           string `mapstructure:"name" validate:"required"`
	Password       string `mapstructure:"password" validate:"required"`
	SslMode        string `mapstructure:"sslmode" default:"disable"`
	ConnectionPool string `mapstructure:"connpool" default:"20"`
	Status         bool   `default:"false"`
}

DatabaseSettings exposes credentials for connecting database

func (*DatabaseSettings) ConnectionString

func (s *DatabaseSettings) ConnectionString() string

ConnectionString returns the concatenated string to connect to db

type GenericSettings

type GenericSettings struct {
	Debug  bool   `mapstructure:"debug"`
	Env    string `mapstructure:"env" default:"development"`
	Expiry int64  `mapstructure:"expiry" default:"10080"` // minutes for 7 days
	Port   int64  `mapstructure:"port" default:"9000"`
}

GenericSettings exposes project's generic settings

Jump to

Keyboard shortcuts

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