config

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2022 License: MIT Imports: 10 Imported by: 2

Documentation

Index

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 NewAppInfo(name, shortName, copyright, about string, major, minor, fix int) Info

func (*Info) About

func (i *Info) About() string

func (*Info) Copyright

func (i *Info) Copyright() string

func (*Info) FixVersion

func (i *Info) FixVersion() int

func (*Info) MajorVersion

func (i *Info) MajorVersion() int

func (*Info) MinorVersion

func (i *Info) MinorVersion() int

func (*Info) Name

func (i *Info) Name() string

func (*Info) ServerString

func (i *Info) ServerString() string

func (*Info) ShortName

func (i *Info) ShortName() string

func (*Info) UserAgentString

func (i *Info) UserAgentString() string

func (*Info) VersionString

func (i *Info) VersionString() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL