Documentation ¶
Overview ¶
Package config offers utilities for parsing a json config file. Values are read as strings, and can be fetched with Get, GetInt or GetBool. The caller is expected to parse them for more complex types.
Index ¶
Constants ¶
const ( ModeDevelopment = iota ModeProduction ModeTest )
Config modes are set when creating a new config
const (
// DefaultPath is where our config is normally found for fragmenta apps.
DefaultPath = "secrets/fragmenta.json"
)
Variables ¶
This section is empty.
Functions ¶
func Configuration ¶
Configuration returns all the configuration key/values for a given mode.
func GetBool ¶
GetBool returns the current configuration value as bool (yes=true, no=false), or false if no value
Types ¶
type Config ¶
type Config struct { Mode int // contains filtered or unexported fields }
Config represents a set of key/value pairs for each mode of the app, production, development and test. Which set of values is used is set by Mode.
var Current *Config
Current is the current configuration object for
func (*Config) Config ¶
Config (Get) returns a specific value or "" if no value For compatability with older server config, we wrap this function Deprecated
func (*Config) Configuration ¶
Configuration returns all the configuration key/values for a given mode.
func (*Config) GetBool ¶
GetBool returns the current configuration value as bool (yes=true, no=false), or false if no value
func (*Config) Production ¶
Production returns true if current config is production.