Documentation ¶
Index ¶
- Constants
- func SetupDefaults()
- type Config
- type ConfigurationLoader
- type Deployment
- type Logging
- type PayD
- type Server
- type Socket
- type Transports
- type ViperConfig
- func (v *ViperConfig) Load() *Config
- func (v *ViperConfig) WithDeployment(appName string) ConfigurationLoader
- func (v *ViperConfig) WithLog() ConfigurationLoader
- func (v *ViperConfig) WithPayD() ConfigurationLoader
- func (v *ViperConfig) WithServer() ConfigurationLoader
- func (v *ViperConfig) WithSockets() ConfigurationLoader
- func (v *ViperConfig) WithTransports() ConfigurationLoader
Constants ¶
const ( EnvServerPort = "server.port" EnvServerHost = "server.host" EnvServerFQDN = "server.fqdn" EnvServerSwaggerEnabled = "server.swagger.enabled" EnvServerSwaggerHost = "server.swagger.host" EnvEnvironment = "env.environment" EnvRegion = "env.region" EnvVersion = "env.version" EnvCommit = "env.commit" EnvBuildDate = "env.builddate" EnvLogLevel = "log.level" EnvPaydHost = "payd.host" EnvPaydPort = "payd.port" EnvPaydSecure = "payd.secure" EnvPaydCertPath = "payd.cert.path" EnvPaydNoop = "payd.noop" EnvSocketChannelTimeoutSeconds = "socket.channel.timeoutseconds" EnvSocketMaxMessageBytes = "socket.maxmessage.bytes" EnvTransportMode = "transport.mode" LogDebug = "debug" LogInfo = "info" LogError = "error" LogWarn = "warn" TransportModeHybrid = "hybrid" TransportModeHTTP = "http" TransportModeSocket = "socket" )
Environment variable constants.
Variables ¶
This section is empty.
Functions ¶
func SetupDefaults ¶
func SetupDefaults()
SetupDefaults will set environment variables to default values.
These can be overwritten when running the service.
Types ¶
type Config ¶
type Config struct { Logging *Logging Server *Server Deployment *Deployment PayD *PayD Sockets *Socket Transports *Transports }
Config returns strongly typed config values.
type ConfigurationLoader ¶
type ConfigurationLoader interface { WithServer() ConfigurationLoader WithDeployment(app string) ConfigurationLoader WithLog() ConfigurationLoader WithPayD() ConfigurationLoader WithSockets() ConfigurationLoader WithTransports() ConfigurationLoader Load() *Config }
ConfigurationLoader will load configuration items into a struct that contains a configuration.
type Deployment ¶
type Deployment struct { Environment string AppName string Region string Version string Commit string BuildDate time.Time }
Deployment contains information relating to the current deployed instance.
func (*Deployment) IsDev ¶
func (d *Deployment) IsDev() bool
IsDev determines if this app is running on a dev environment.
func (*Deployment) String ¶
func (d *Deployment) String() string
type PayD ¶
PayD is used to setup connection to a payd instance. In this case, we connect to only one merchant wallet implementors may need to connect to more.
type Server ¶
type Server struct { Port string Hostname string // FQDN - fully qualified domain name, used to form the paymentRequest // payment URL as this may be different from the hostname + port. FQDN string // SwaggerEnabled if true we will include an endpoint to serve swagger documents. SwaggerEnabled bool SwaggerHost string }
Server contains all settings required to run a web server.
type Transports ¶
type Transports struct {
Mode string
}
Transports enables or disables dpp transports.
type ViperConfig ¶
type ViperConfig struct {
*Config
}
ViperConfig contains viper based configuration data.
func NewViperConfig ¶
func NewViperConfig(appname string) *ViperConfig
NewViperConfig will setup and return a new viper based configuration handler.
func (*ViperConfig) Load ¶
func (v *ViperConfig) Load() *Config
Load will return the underlying config setup.
func (*ViperConfig) WithDeployment ¶
func (v *ViperConfig) WithDeployment(appName string) ConfigurationLoader
WithDeployment sets up the deployment configuration if required.
func (*ViperConfig) WithLog ¶
func (v *ViperConfig) WithLog() ConfigurationLoader
WithLog sets up and returns log config.
func (*ViperConfig) WithPayD ¶
func (v *ViperConfig) WithPayD() ConfigurationLoader
WithPayD sets up and returns PayD viper config.
func (*ViperConfig) WithServer ¶
func (v *ViperConfig) WithServer() ConfigurationLoader
WithServer will setup the web server configuration if required.
func (*ViperConfig) WithSockets ¶
func (v *ViperConfig) WithSockets() ConfigurationLoader
WithSockets reads socket env vars.
func (*ViperConfig) WithTransports ¶
func (v *ViperConfig) WithTransports() ConfigurationLoader
WithTransports reads transport config.