Documentation
¶
Index ¶
- Constants
- func SetupDefaults()
- type Config
- type ConfigurationLoader
- type Db
- type DbType
- type Deployment
- type HeadersClient
- type Logging
- type MApi
- type NetworkType
- type P4
- type PeerChannels
- type Server
- type Socket
- type Transports
- type ViperConfig
- func (v *ViperConfig) Load() *Config
- func (v *ViperConfig) WithDb() ConfigurationLoader
- func (v *ViperConfig) WithDeployment(appName string) ConfigurationLoader
- func (v *ViperConfig) WithHeadersClient() ConfigurationLoader
- func (v *ViperConfig) WithLog() ConfigurationLoader
- func (v *ViperConfig) WithMapi() ConfigurationLoader
- func (v *ViperConfig) WithP4() ConfigurationLoader
- func (v *ViperConfig) WithPeerChannels() ConfigurationLoader
- func (v *ViperConfig) WithServer() ConfigurationLoader
- func (v *ViperConfig) WithSocket() ConfigurationLoader
- func (v *ViperConfig) WithTransports() ConfigurationLoader
- func (v *ViperConfig) WithWallet() ConfigurationLoader
- type Wallet
Constants ¶
const ( EnvServerPort = "server.port" EnvServerHost = "server.host" EnvServerSwaggerEnabled = "server.swagger.enabled" EnvServerSwaggerHost = "server.swagger.host" EnvEnvironment = "env.environment" EnvRegion = "env.region" EnvVersion = "env.version" EnvCommit = "env.commit" EnvBuildDate = "env.builddate" EnvBitcoinNetwork = "env.bitcoin.network" EnvLogLevel = "log.level" EnvDb = "db.type" EnvDbSchema = "db.schema.path" EnvDbDsn = "db.dsn" EnvDbMigrate = "db.migrate" EnvHeadersClientAddress = "headersclient.address" EnvHeadersClientTimeout = "headersclient.timeout" EnvNetwork = "wallet.network" EnvWalletSpvRequired = "wallet.spvrequired" EnvPaymentExpiry = "wallet.paymentexpiry" EnvP4Timeout = "p4.timeout" EnvP4Host = "p4.host" EnvMAPIMinerName = "mapi.minername" EnvMAPIURL = "mapi.minerurl" EnvMAPIToken = "mapi.token" EnvMAPICallbackHost = "mapi.callback.host" EnvSocketMaxMessageBytes = "socket.maxmessage.bytes" EnvTransportHTTPEnabled = "transport.http.enabled" EnvTransportSocketsEnabled = "transport.sockets.enabled" EnvPeerChannelsHost = "peerchannels.host" EnvPeerChannelsTTL = "peerchannels.ttl.minutes" LogDebug = "debug" LogInfo = "info" LogError = "error" LogWarn = "warn" )
Environment variable constants.
Variables ¶
This section is empty.
Functions ¶
func SetupDefaults ¶
func SetupDefaults()
SetupDefaults will setup default config values. These can all be overwritten by environment variables.
Types ¶
type Config ¶
type Config struct {
Logging *Logging
Server *Server
Deployment *Deployment
Db *Db
HeadersClient *HeadersClient
Wallet *Wallet
PeerChannels *PeerChannels
P4 *P4
Mapi *MApi
Socket *Socket
Transports *Transports
}
Config returns strongly typed config values.
type ConfigurationLoader ¶
type ConfigurationLoader interface {
WithServer() ConfigurationLoader
WithDb() ConfigurationLoader
WithDeployment(app string) ConfigurationLoader
WithLog() ConfigurationLoader
WithWallet() ConfigurationLoader
WithP4() ConfigurationLoader
WithHeadersClient() ConfigurationLoader
WithSocket() ConfigurationLoader
WithTransports() ConfigurationLoader
WithMapi() ConfigurationLoader
WithPeerChannels() 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 HeadersClient ¶
HeadersClient contains HeadersClient information.
type NetworkType ¶ added in v0.0.8
type NetworkType string
NetworkType is used to restrict the networks we can support.
const ( NetworkRegtest NetworkType = "regtest" NetworkSTN NetworkType = "stn" NetworkTestnet NetworkType = "testnet" NetworkMainet NetworkType = "mainnet" )
Supported bitcoin network types.
func (NetworkType) String ¶ added in v0.1.1
func (n NetworkType) String() string
type PeerChannels ¶ added in v0.1.3
type PeerChannels struct {
// Host the peer channels host.
Host string
// TTL the life of the peer channel.
TTL time.Duration
}
PeerChannels information relating to peer channel interactions.
type Server ¶
type Server struct {
Port string
Hostname 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 ¶ added in v0.1.1
Transports enables or disables p4 transports.
type ViperConfig ¶ added in v0.1.1
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 ¶ added in v0.1.1
func (v *ViperConfig) Load() *Config
Load will return the underlying config setup.
func (*ViperConfig) WithDb ¶ added in v0.1.1
func (v *ViperConfig) WithDb() ConfigurationLoader
WithDb sets up and returns database configuration.
func (*ViperConfig) WithDeployment ¶ added in v0.1.1
func (v *ViperConfig) WithDeployment(appName string) ConfigurationLoader
WithDeployment sets up the deployment configuration if required.
func (*ViperConfig) WithHeadersClient ¶ added in v0.1.1
func (v *ViperConfig) WithHeadersClient() ConfigurationLoader
WithHeadersClient sets up and returns headers client configuration.
func (*ViperConfig) WithLog ¶ added in v0.1.1
func (v *ViperConfig) WithLog() ConfigurationLoader
WithLog sets up and returns log config.
func (*ViperConfig) WithMapi ¶ added in v0.1.1
func (v *ViperConfig) WithMapi() ConfigurationLoader
WithMapi will setup Mapi settings.
func (*ViperConfig) WithP4 ¶ added in v0.1.1
func (v *ViperConfig) WithP4() ConfigurationLoader
WithP4 sets up and return p4 interface configuration.
func (*ViperConfig) WithPeerChannels ¶ added in v0.1.3
func (v *ViperConfig) WithPeerChannels() ConfigurationLoader
WithPeerChannels reads peer channels config.
func (*ViperConfig) WithServer ¶ added in v0.1.1
func (v *ViperConfig) WithServer() ConfigurationLoader
WithServer will setup the web server configuration if required.
func (*ViperConfig) WithSocket ¶ added in v0.1.1
func (v *ViperConfig) WithSocket() ConfigurationLoader
WithSocket will setup Mapi settings.
func (*ViperConfig) WithTransports ¶ added in v0.1.1
func (v *ViperConfig) WithTransports() ConfigurationLoader
WithTransports reads transport config.
func (*ViperConfig) WithWallet ¶ added in v0.1.1
func (v *ViperConfig) WithWallet() ConfigurationLoader
WithWallet sets up and returns merchant wallet configuration.
type Wallet ¶
type Wallet struct {
Network NetworkType
SPVRequired bool
PaymentExpiryHours int64
}
Wallet contains information relating to a payd installation.