conf

package
v0.0.0-...-aec1c34 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLoadConf          = errors.New("conf: error loading configuration")
	ErrReloadConf        = errors.New("conf: error reloading configuration")
	ErrAlreadyLoaded     = errors.New("conf: configuration already exist")
	ErrNoConfigFileFound = errors.New("conf: configuration file not provided/found")

	// C is the global configuration obj
	C = &Config{}
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Env string `mapstructure:"env"`

	ReqIDKey    string `mapstructure:"req_id_key"`
	SVCName     string `mapstructure:"svc_name"`
	NATSUrl     string `mapstructure:"nats_url"`
	AuthzSvcUrl string `mapstructure:"authzsvc_url"`

	Postgres struct {
		Host     string `mapstructure:"host"`
		Port     int    `mapstructure:"port"`
		User     string `mapstructure:"user"`
		Password string `mapstructure:"password"`
		DB       string `mapstructure:"db"`
		SSLMode  string `mapstructure:"sslmode"`
	} `mapstructure:"postgres"`

	Redis struct {
		Addr     string `mapstructure:"addr"`
		Password string `mapstructure:"password"`
		DB       int    `mapstructure:"db"`
	} `mapstructure:"redis"`

	Auth struct {
		SecretKey       string        `mapstructure:"secret_key"`
		Issuer          string        `mapstructure:"issuer"`
		AccessTokenTTL  time.Duration `mapstructure:"access_token_ttl"`
		RefreshTokenTTL time.Duration `mapstructure:"refresh_token_ttl"`
		AccessKID       string        `mapstructure:"access_kid"`
		RefreshKID      string        `mapstructure:"refresh_kid"`
	} `mapstructure:"auth"`
}

Config hold the user service configuration

func Load

func Load(confFname string) (*Config, error)

Load reads the config file and returns read configs

func (*Config) GetDSN

func (c *Config) GetDSN() (dsn string)

func (*Config) Load

func (c *Config) Load(confFname string) error

Jump to

Keyboard shortcuts

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