Documentation ¶
Index ¶
- Variables
- func ExpandString(str string) string
- func GetSetting(str string) string
- func GetVariable(str string) string
- func VariableExists(str string) bool
- type Config
- func (c *Config) ExpandString(str string) string
- func (c *Config) GetSetting(name string) string
- func (c *Config) GetVariable(path string) string
- func (c *Config) SetVariable(path, value string)
- func (c *Config) SettingExists(name string) bool
- func (c *Config) String() string
- func (c *Config) VariableExists(path string) bool
- func (c *Config) Write()
Constants ¶
This section is empty.
Variables ¶
var GlobalConfig = loadConfigFile("config.json")
GlobalConfig - The global configuration read from config.json
var InMemory = false
InMemory - When true the config will not write to the disk. This is used for testing.
var LocalConfig = loadConfigFile("config.local.json")
LocalConfig - The local configuration read from config.local.json
var ProjectPath = "."
The path to the project root
var TempConfig = loadDefaultConfig()
TempConfig - A temporary config object that persists only for the current session.
Functions ¶
func ExpandString ¶ added in v0.1.2
ExpandString - Given a string with a variable inside it. The string will be expanded and the variable placeholders replaced with variables from either config. Priority goes to the local config.
func GetSetting ¶ added in v0.3.0
GetSetting - Returns the value of a variable from either config. Priority goes to the local config.
func GetVariable ¶ added in v0.1.2
GetVariable - Returns the value of a variable from either config. Priority goes to the local config.
func VariableExists ¶ added in v0.1.2
VariableExists - Checks if a variable exists in either config.
Types ¶
type Config ¶
type Config struct { Filename string // contains filtered or unexported fields }
Config - The config object is used to store the application configuration. The package attempts instantiate two configs one for the local config and one for the global config.
func (*Config) ExpandString ¶ added in v0.1.2
ExpandString - Given a string with a variable inside it. The string will be expanded and the variable placeholders replaced with variables from the config.
func (*Config) GetSetting ¶
GetSetting - Returns a setting as a string from the path specified in the config.
func (*Config) GetVariable ¶
GetVariable returns a saved variable from the config.
func (*Config) SetVariable ¶
SetVariable - sets a variable in the config.
func (*Config) SettingExists ¶ added in v0.3.0
SettingExists - returns true if a setting is specified in the config.
func (*Config) VariableExists ¶
VariableExists - Checks to see if a variable exists at the path specified.