Documentation ¶
Index ¶
- Variables
- func Configure(obj interface{}, file string, metaData ...interface{}) error
- func InitConfigurator()
- func IsDir(dir string) bool
- func IsFile(path string) bool
- func JoinPath(elems ...string) string
- func ProfileDirFromEnv() string
- func ReadConfigFile(obj interface{}, file string) error
- func SetConfigurator(c Configurator)
- type Configuration
- type Configurator
- type DBConf
- type RedisConf
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // EnvProfileDir is the name of the environment variable for the search // directory of the profile EnvProfileDir = "PROJECT_CONFIG" // ProfileENV is the name of the profile directory in environment variable ProfileENV = EnvProfileDir )
Functions ¶
func InitConfigurator ¶
func InitConfigurator()
func IsDir ¶
IsDir accepts a string with a directory path and tests the path. It returns true if the path exists and it is a directory, and false otherwise.
func IsFile ¶
IsFile accepts a string with a file path and tests the path. It returns true if the path exists and it is a file, and false otherwise.
func JoinPath ¶
JoinPath returns a string that joins any number of path elements into a single path, separating them with slashes.
func ProfileDirFromEnv ¶
func ProfileDirFromEnv() string
ProfileDirFromEnv reads from environment variable with EnvProfileDir
func ReadConfigFile ¶
func SetConfigurator ¶
func SetConfigurator(c Configurator)
SetConfigurator assigns a Configurator to global configurator
Types ¶
type Configuration ¶
Configuration .
type Configurator ¶
type Configurator interface {
Configure(obj interface{}, file string, metaData ...interface{}) error
}
Configurator .
type DBConf ¶
type DBConf struct { DSN string `toml:"dsn"` MaxOpenConns int `toml:"max_open_conns"` MaxIdleConns int `toml:"max_idle_conns"` ConnMaxLifeTime int `toml:"conn_max_life_time"` }
DBConf .
type RedisConf ¶
type RedisConf struct { Addr string `toml:"addr"` Password string `toml:"password"` DB int `toml:"db"` MaxRetries int `toml:"max_retries"` PoolSize int `toml:"pool_size"` ReadTimeout int `toml:"read_timeout"` WriteTimeout int `toml:"write_timeout"` IdleTimeout int `toml:"idle_timeout"` IdleCheckFrequency int `toml:"idle_check_frequency"` MaxConnAge int `toml:"max_conn_age"` PoolTimeout int `toml:"pool_timeout"` }
RedisConf .
Click to show internal directories.
Click to hide internal directories.