Documentation ¶
Index ¶
- Variables
- func InitConfig(bootstrapConfig *BootstrapConfig)
- type BootstrapConfig
- func (c *BootstrapConfig) AddLinuxPaths(rootPaths, homeRelativePaths []string) *BootstrapConfig
- func (c *BootstrapConfig) AddWindowsPaths(rootPaths, homeRelativePaths []string) *BootstrapConfig
- func (c *BootstrapConfig) SetConfigFile(file string) *BootstrapConfig
- func (c *BootstrapConfig) SetConfigType(_type string) *BootstrapConfig
- func (c *BootstrapConfig) SetEnvVarPrefix(prefix string) *BootstrapConfig
- type PathOptions
- type PathSet
Constants ¶
This section is empty.
Variables ¶
var AppConfigFile string
AppConfigFile defines what app's config file should be used. In case it is specified, BootstrapConfig is not used, because there is not need to search for app's config file It has to be exported var in order to be used in cases such as: rootCmd.PersistentFlags().StringVar(&config.ConfigFile, "config", "", fmt.Sprintf("config file (default: %s)", defaultConfigFile))
Functions ¶
func InitConfig ¶
func InitConfig(bootstrapConfig *BootstrapConfig)
InitConfig initializes application config according to provided BootstrapConfig options and reads in found app's config file and ENV variables if set.
Types ¶
type BootstrapConfig ¶
type BootstrapConfig struct {
// contains filtered or unexported fields
}
BootstrapConfig specifies how to bootstrap application's configuration. It provides configuration options on:
- where to look for config files
- what config file type to look for
- should ENV VARs be used as config options ... etc
func (*BootstrapConfig) AddLinuxPaths ¶
func (c *BootstrapConfig) AddLinuxPaths(rootPaths, homeRelativePaths []string) *BootstrapConfig
AddLinuxPaths
func (*BootstrapConfig) AddWindowsPaths ¶
func (c *BootstrapConfig) AddWindowsPaths(rootPaths, homeRelativePaths []string) *BootstrapConfig
AddWindowsPaths
func (*BootstrapConfig) SetConfigFile ¶
func (c *BootstrapConfig) SetConfigFile(file string) *BootstrapConfig
SetConfigFile
func (*BootstrapConfig) SetConfigType ¶
func (c *BootstrapConfig) SetConfigType(_type string) *BootstrapConfig
SetConfigType
func (*BootstrapConfig) SetEnvVarPrefix ¶
func (c *BootstrapConfig) SetEnvVarPrefix(prefix string) *BootstrapConfig
SetEnvVarPrefix
type PathOptions ¶
PathOptions specifies set of PathSet's for different platforms. Ex.: pathOptions["linux"] = PathSet with Linux paths pathOptions["windows"] = PathSet with Windows paths