Documentation
¶
Overview ¶
Package gconfig - Spring boot style configuration manager. It can load properties files. properties file should follow the naming convention:
- application.properties: this holds all the default configuration values as key/value pair.
- application-{profile}.properties. contains all the environment specific configuration values. eg: for prod environment, application-prod.properties
Index ¶
- Constants
- Variables
- type GConfig
- func (c GConfig) Exists(key string) bool
- func (c GConfig) GetBool(key string) bool
- func (c GConfig) GetFloat(key string) float64
- func (c GConfig) GetInt(key string) int
- func (c GConfig) GetString(key string) string
- func (c GConfig) GetStringOrDefault(key string) string
- func (c GConfig) GetStringOrDefaultInCommaSeparator(key string) string
Constants ¶
const ( // PropertiesExtension defines extension for properties file PropertiesExtension string = ".properties" // StandardPropFileName standard properties file if default is not defined StandardPropFileName string = "application.properties" )
Variables ¶
var ErrConfigFileRequired = errors.New("At least one configuration file is required")
ErrConfigFileRequired represents file required error
Functions ¶
This section is empty.
Types ¶
type GConfig ¶
type GConfig struct {
Profile string
// contains filtered or unexported fields
}
GConfig is the representation of all the configuration properties. It loads 2 types of data: default and environment specific. One out of 2 must be present otherwise, error is returned during the Load operation
var Gcg *GConfig
Gcg is a global variable that represents configuration
func Load ¶
Load reads all the properties and creates GConfig representation. It loads config data based on passed in flags or environment variables. If none is defined it uses default values.
func (GConfig) GetStringOrDefault ¶
GetString returns string value for the given key
func (GConfig) GetStringOrDefaultInCommaSeparator ¶
GetString returns string value for the given key