conf

package
v0.0.0-...-a71e659 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2020 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PluginHostsKey string separated list of plugin URLs
	PluginHostsKey = "plugin_hosts"

	ExchangeRatesPluginKey    = "exchange_rates_plugin"
	CurrencyMetadataPluginKey = "currency_metadata_plugin"

	// WalletPollingIntervalKey determines how often to poll wallets for new transfers
	WalletPollingIntervalKey = "wallet_poller_interval"

	PricingCurrenciesKey      = "pricing_currencies"
	DefaultPricingCurrencyKey = "default_pricing_currency"
	PaymentMethodsKey         = "payment_methods"
)

The keys for the Runtime config

Variables

View Source
var (
	// Executable is overridden by Makefile with executable name
	Executable = "NoExecutable"
	// GitVersion is overridden by Makefile with git information
	GitVersion = "NoGitVersion"
)

Providers for wire

View Source
var (
	// Global Stop instance
	Stop = &stop{
		c: make(chan struct{}),
	}
)

Functions

func InitializeConfigFile

func InitializeConfigFile(path string) (bool, error)

InitializeConfigFile will read a file from the provided path if it's found, it will read the config with viper. If not, it will create and initialize the file with defaults

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager is in charge of handling config logics

func NewManager

func NewManager(
	logger hclog.Logger,
	runtime *Runtime) Manager

NewManager creates a Manager instance

func (Manager) SaveConfiguration

func (m Manager) SaveConfiguration(key string, newValue interface{}) error

SaveConfiguration updates conf.Runtime with the new key/value pair. it will also save the file to disk.

type Runtime

type Runtime struct {
	*viper.Viper
	// contains filtered or unexported fields
}

Runtime is the config that is used on runtime and can be changed after the application has started

func NewRuntimeConfig

func NewRuntimeConfig(
	logger hclog.Logger,
	configPath string) *Runtime

NewRuntimeConfig creates the runtime config

func (*Runtime) GetCurrencyMetadataPlugin

func (r *Runtime) GetCurrencyMetadataPlugin() string

func (*Runtime) GetDefaultPricingCurrency

func (r *Runtime) GetDefaultPricingCurrency() string

func (*Runtime) GetExchangeRatesPlugin

func (r *Runtime) GetExchangeRatesPlugin() string

func (*Runtime) GetPaymentMethods

func (r *Runtime) GetPaymentMethods() []string

func (*Runtime) GetPluginHosts

func (r *Runtime) GetPluginHosts() []string

func (*Runtime) GetPricingCurrencies

func (r *Runtime) GetPricingCurrencies() []string

func (*Runtime) GetWalletPollingInterval

func (r *Runtime) GetWalletPollingInterval() time.Duration

func (*Runtime) InitializeConfigFile

func (r *Runtime) InitializeConfigFile(path string) error

InitializeConfigFile will read a file from the provided path if it's found, it will read the config with viper. If not, it will create and initialize the file with defaults

func (*Runtime) IsKnownKey

func (r *Runtime) IsKnownKey(key string) bool

IsKnownKey returns true when a provided key is a known runtime conf key.

type Startup

type Startup struct {
	Logger  StartupLogger  `mapstructure:"logger"`
	PIDFile string         `mapstructure:"pidfile"`
	Server  StartupServer  `mapstructure:"server"`
	Storage StartupStorage `mapstructure:"storage"`
}

func LoadStartupConfig

func LoadStartupConfig() (Startup, error)

LoadStartupConfig uses viper to unmarshal the config into struct

type StartupInternalServer

type StartupInternalServer struct {
	Host string `mapstructure:"host"`
	Port string `mapstructure:"port"`
}

type StartupLogger

type StartupLogger struct {
	Level string `mapstructure:"level"`
}

type StartupPublicServer

type StartupPublicServer struct {
	Host string `mapstructure:"host"`
	Port string `mapstructure:"port"`
}

type StartupServer

type StartupServer struct {
	LogRequests     bool                  `mapstructure:"log_requests"`
	ProfilerEnabled bool                  `mapstructure:"profiler_enabled"`
	ProfilerPath    string                `mapstructure:"profiler_path"`
	Internal        StartupInternalServer `mapstructure:"internal"`
	Public          StartupPublicServer   `mapstructure:"public"`
}

type StartupStorage

type StartupStorage struct {
	Host     string `mapstructure:"host"`
	Port     string `mapstructure:"port"`
	Database string `mapstructure:"database"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
	SSLMode  string `mapstructure:"sslmode"`
	Type     string `mapstructure:"type"`
}

Jump to

Keyboard shortcuts

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