Documentation ¶
Index ¶
- Constants
- Variables
- func AppSessionKey() string
- func SetConfigLocation(loc string)
- func SetProvider(provider ConfigProvider)
- type ConfigProvider
- 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 ( PortENV = "PORT" // runtime settings ConfigDirLocationENV = "CONFIG_LOCATION" // config settings AppSessionKeyENV = "APP_SESSION_KEY" // Session/Auth key used to encrypt cookies with APIEndpointENV = "API_ENDPOINT" // client settings ForceTraceENV = "API_FORCE_TRACE" // Other constants DefaultConfigName = "config" DefaultConfigLocation = "./.config" DefaultCredentialsLocation = "./.secrets" 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 AppSessionKey ¶ added in v0.2.0
func AppSessionKey() string
AppSessionKey is initialized from ENV['APP_SESSION_KEY'] or randomly generated on startup, if not provided.
func SetConfigLocation ¶
func SetConfigLocation(loc string)
SetConfigLocation sets the actual location without checking if the location actually exists !
func SetProvider ¶
func SetProvider(provider ConfigProvider)
Types ¶
type ConfigProvider ¶ added in v0.2.0
type ConfigProvider interface { // AppInfo returns static information about the app or service Info() *Info // Settings returns the app settings, if configured, or falls back to a default, minimal configuration Settings() *settings.DialSettings // ConfigLocation returns the path to the config location, if set, or the default location otherwise. ConfigLocation() string // './.config' unless explicitly set. // SetConfigLocation explicitly sets the location where the configuration is expected. The location's existence is NOT verified. SetConfigLocation(string) }
func GetConfig ¶
func GetConfig() ConfigProvider
func NewLocalConfigProvider ¶
func NewLocalConfigProvider() ConfigProvider
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.