config

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: ISC Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
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"
	EnvNodeHost       = "node.host"
	EnvNodePort       = "node.port"
	EnvNodeUser       = "node.username"
	EnvNodePassword   = "node.password"
	EnvNodeSSL        = "node.usessl"
	EnvAblyKey        = "ably.key"
	EnvAblyUsername   = "ably.username"
	EnvAblyMaxMessage = "ably.maxmessage"

	LogDebug = "debug"
	LogInfo  = "info"
	LogError = "error"
	LogWarn  = "warn"
)

Environment variable constants.

Variables

This section is empty.

Functions

func SetDefaults

func SetDefaults()

Types

type Ably

type Ably struct {
	Key        string
	Username   string
	MaxMessage int64
}

type BitcoinNode

type BitcoinNode struct {
	Host     string
	Port     int
	Username string
	Password string
	UseSSL   bool
}

BitcoinNode config params for connecting to a bitcoin node.

type Config

type Config struct {
	Logging    *Logging
	Server     *Server
	Deployment *Deployment
	Node       *BitcoinNode
	Ably       *Ably
}

Config returns strongly typed config values.

func NewViperConfig

func NewViperConfig(appname string) *Config

NewViperConfig will setup and return a new viper based configuration handler.

func (*Config) Validate

func (c *Config) Validate() error

Validate will check config values are valid and return a list of failures if any have been found.

func (*Config) WithAbly

func (c *Config) WithAbly() *Config

WithAbly sets up the header client with the type of syncing we wish to do.

func (*Config) WithBitcoinNode

func (c *Config) WithBitcoinNode() *Config

WithBitcoinNode sets up and returns bitcoin node configuration.

func (*Config) WithDeployment

func (c *Config) WithDeployment(appName string) *Config

WithDeployment sets up the deployment configuration if required.

func (*Config) WithLog

func (c *Config) WithLog() *Config

WithLog sets up and returns log config.

func (*Config) WithServer

func (c *Config) WithServer() *Config

WithServer will setup the web server configuration if required.

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 Logging

type Logging struct {
	Level string
}

Logging contains log configuration.

type Server

type Server struct {
	Port     string
	Hostname string
}

Server contains all settings required to run a web server.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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