Documentation ¶
Index ¶
- Constants
- func SetupDefaults()
- func SetupLog(cfg *Logging)
- type Config
- func (c *Config) Validate() error
- func (c *Config) WithDb() *Config
- func (c *Config) WithDeployment(appName string) *Config
- func (c *Config) WithHeadersClient() *Config
- func (c *Config) WithLog() *Config
- func (c *Config) WithMapi() *Config
- func (c *Config) WithP4() *Config
- func (c *Config) WithServer() *Config
- func (c *Config) WithWallet() *Config
- type ConfigurationLoader
- type Db
- type DbType
- type Deployment
- type HeadersClient
- type Logging
- type MApi
- type P4
- type Server
- type Wallet
Constants ¶
const ( EnvServerPort = "server.port" EnvServerHost = "server.host" EnvEnvironment = "env.environment" EnvMainNet = "env.mainnet" EnvRegion = "env.region" EnvVersion = "env.version" EnvCommit = "env.commit" EnvBuildDate = "env.builddate" 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" EnvMAPIMinerName = "mapi.minername" EnvMAPIURL = "mapi.minerurl" EnvMAPIToken = "mapi.token" 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 P4 *P4 Mapi *MApi }
Config returns strongly typed config values.
func NewViperConfig ¶
NewViperConfig will setup and return a new viper based configuration handler.
func (*Config) WithDeployment ¶
WithDeployment sets up the deployment configuration if required.
func (*Config) WithHeadersClient ¶
WithHeadersClient sets up and returns headers client configuration.
func (*Config) WithServer ¶
WithServer will setup the web server configuration if required.
func (*Config) WithWallet ¶
WithWallet sets up and returns merchant wallet configuration.
type ConfigurationLoader ¶
type ConfigurationLoader interface { WithServer() *Config WithDb() *Config WithDeployment(app string) *Config WithLog() *Config WithPaymail() *Config WithWallet() *Config WithP4() *Config WithHeadersClient() *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 MainNet bool }
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 P4 ¶ added in v0.0.2
type P4 struct {
Timeout int
}
P4 contains information relating to a p4 interactions.