Documentation
¶
Index ¶
- Constants
- Variables
- func NewLocalConfigProvider() interface{}
- func ResolveConfigLocation() string
- func SetConfigLocation(loc string)
- func SetProvider(provider interface{})
- type Configurator
- type Info
- func (i *Info) About() string
- func (i *Info) Copyright() string
- func (i *Info) FixVersion() int
- func (i *Info) MajorVersion() int
- func (i *Info) MinorVersion() int
- func (i *Info) Name() string
- func (i *Info) ServerString() string
- func (i *Info) ShortName() string
- func (i *Info) UserAgentString() string
- func (i *Info) VersionString() string
Constants ¶
View Source
const ( // runtime settings PortEnv = "PORT" APIEndpointENV = "API_ENDPOINT" // client settings ForceTraceEnv = "APIKIT_FORCE_TRACE" // config settings ConfigDirLocationENV = "CONFIG_LOCATION" DefaultConfigName = "config" DefaultConfigLocation = "./.config" DefaultEndpoint = "http://localhost:8080" // only really useful for testing ... )
Variables ¶
View Source
var ( // ErrMissingConfigurator indicates that the config package is not initialized ErrMissingConfigurator = errors.New("missing configurator") // ErrInitializingConfiguration indicates that the client could not be initialized ErrInitializingConfiguration = errors.New("error initializing configuration") // ErrInvalidConfiguration indicates that parameters used to configure the service were invalid ErrInvalidConfiguration = errors.New("invalid configuration") )
Functions ¶
func NewLocalConfigProvider ¶
func NewLocalConfigProvider() interface{}
func ResolveConfigLocation ¶
func ResolveConfigLocation() string
ResolveConfigLocation returns the full path to the config location
func SetConfigLocation ¶
func SetConfigLocation(loc string)
SetConfigLocation sets the actual location without checking if the location actually exists !
func SetProvider ¶
func SetProvider(provider interface{})
Types ¶
type Configurator ¶
type Configurator interface {
// AppInfo returns static information about the app or service
Info() *Info
// GetScopes returns the user-provided scopes, if set, or else falls back to the default scopes.
GetScopes() []string
// GetConfigLocation returns the path to the config location, if set, or the default location otherwise.
GetConfigLocation() string // './.config' unless explicitly set.
// SetConfigLocation explicitly sets the location where the configuration is expected. The location's existence is NOT verified.
SetConfigLocation(string)
// Settings returns the app settings, if configured, or falls back to a default, minimal configuration
Settings() *settings.DialSettings
}
func GetConfig ¶
func GetConfig() Configurator
type Info ¶
type Info struct {
// contains filtered or unexported fields
}
Info holds static information about a service or API
func NewAppInfo ¶
func (*Info) FixVersion ¶
func (*Info) MajorVersion ¶
func (*Info) MinorVersion ¶
func (*Info) ServerString ¶
func (*Info) UserAgentString ¶
func (*Info) VersionString ¶
Click to show internal directories.
Click to hide internal directories.