config

package
v0.0.0-...-fcf22e6 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const FileTypeJson fileType = "json"
View Source
const FileTypeToml fileType = "toml"
View Source
const FileTypeYaml fileType = "yaml"

Variables

This section is empty.

Functions

func Init

func Init(path string, config interface{}) error

Init config from specified path

func InitWithType

func InitWithType(configPath string, config interface{}, fileType fileType) error

InitWithType initialize configuration from file with specified FileType

func SetEnvironmentServerPort

func SetEnvironmentServerPort(config interface{})

Types

type APP

type APP struct {
	PORT     string
	NAME     string
	VERSION  string
	TRACING  string
	LOGLEVEL string
}

func (*APP) GetLogLevel

func (a *APP) GetLogLevel() string

func (*APP) GetName

func (a *APP) GetName() string

func (*APP) GetPort

func (a *APP) GetPort() int

func (*APP) GetVersion

func (a *APP) GetVersion() string

func (*APP) SetLogLevel

func (a *APP) SetLogLevel(logLevel string)

func (*APP) SetPort

func (a *APP) SetPort(port string)

func (*APP) Tracing

func (a *APP) Tracing() bool

type AWS

type AWS struct {
	REGION string
	ID     string
	KEY    string
	TOKEN  string
}

type AppConfig

type AppConfig interface {
	GetPort() int
	SetPort(port string)
	Tracing() bool
	GetName() string
	GetVersion() string
	SetLogLevel(logLevel string)
	GetLogLevel() string
}

type DB

type DB struct {
	DIALECT          string
	HOST             string
	PORT             string
	USERNAME         string
	PASSWORD         string
	DATABASE         string
	TIMEOUT          string
	PARSETIME        string
	MAXIDLE_CONN     int
	MAXOPEN_CONN     int
	MAXCONN_LIFETIME int // minute
}

type PARAMETER

type PARAMETER struct {
	NAME     string
	SECURED  string
	REGION   string
	CREDTYPE string
}

func (PARAMETER) Secured

func (p PARAMETER) Secured() bool

type REDIS

type REDIS struct {
	ADDR           string
	PASSWORD       string
	DB             string
	POOLSIZE       string
	DURATION       string
	MARSHALINDENT  string
	MODE           string
	ROUTEBYLATENCY string
	ROUTERANDOMLY  string
	DIALTIMEOUT    string
}

func (REDIS) GetDB

func (r REDIS) GetDB() int

func (REDIS) GetDialTimeOut

func (r REDIS) GetDialTimeOut() time.Duration

func (REDIS) GetDuration

func (r REDIS) GetDuration() (*time.Duration, error)

func (REDIS) GetPoolSize

func (r REDIS) GetPoolSize() int

func (REDIS) IsMarshalIndent

func (r REDIS) IsMarshalIndent() bool

func (REDIS) RouteByLatency

func (r REDIS) RouteByLatency() bool

func (REDIS) RouteRandomly

func (r REDIS) RouteRandomly() bool

type SECRET

type SECRET struct {
	TYPE    string
	NAME    string
	VERSION string
}

Jump to

Keyboard shortcuts

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