Documentation ¶
Overview ¶
Package config provides configuration flags. These can be configured via command line flags, environment variables or via Consul.
Index ¶
Constants ¶
const PackageName = "config"
PackageName is the name of this package.
Variables ¶
var ConfigFlag = DeclareString("", "config", "")
ConfigFlag is the service identifier used to get/monitor the flags from consul.
var ( // ConsulAddressFlag is the address consul's HTTP interface listens on in // format <ip>:<port>. ConsulAddressFlag = DeclareString( PackageName, "consulAddress", "leverosconsul:8500") )
var ( // RestArgs represents the list of command line args remaining after all // the flags. RestArgs []string )
Functions ¶
func GetConsulClient ¶
GetConsulClient returns a readily-configured consul client.
func Initialize ¶
func Initialize()
Initialize needs to be called before any call to Get. It parses command line flags and begins monitoring of consul key holding the flags for this service.
func UploadFile ¶
UploadFile uploads provided config file to consul for use as flags.
Types ¶
type FlagBool ¶
type FlagBool struct {
// contains filtered or unexported fields
}
FlagBool represents a boolean configuration.
func DeclareBool ¶
DeclareBool can be used to declare a new bool flag with a default value false.
type FlagDuration ¶
type FlagDuration struct {
// contains filtered or unexported fields
}
FlagDuration represents a duration configuration.
func DeclareDuration ¶
func DeclareDuration( pack, name string, defaultValue time.Duration) *FlagDuration
DeclareDuration can be used to declare a new duration flag with a default value.
func (*FlagDuration) Get ¶
func (flag *FlagDuration) Get() time.Duration
Get retrieves the value of flag.
type FlagFloat ¶
type FlagFloat struct {
// contains filtered or unexported fields
}
FlagFloat represents a float configuration.
func DeclareFloat ¶
DeclareFloat can be used to declare a new float flag with a default value.
type FlagInt ¶
type FlagInt struct {
// contains filtered or unexported fields
}
FlagInt represents an integer configuration.
func DeclareInt ¶
DeclareInt can be used to declare a new int flag with a default value.
type FlagString ¶
type FlagString struct {
// contains filtered or unexported fields
}
FlagString represents a string configuration.
func DeclareString ¶
func DeclareString(pack, name, defaultValue string) *FlagString
DeclareString can be used to declare a new string flag with a default value.