Documentation
¶
Overview ¶
Package config contains structures used in retrieving app configuration from disk.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNil indicates that a nil/null pointer was encountered. ErrNil = errors.New("nil pointer") // ErrMissingEmptyConfigSection indicates that a required config file section is missing (not present) or empty (zero-length). ErrMissingEmptyConfigSection = errors.New("config file section is missing/empty") // ErrInvalidValue indicates that a value was invalid. ErrInvalidValue = errors.New("invalid value") )
Functions ¶
func CheckConfig ¶
CheckConfig checks the config for valid structure and values.
func ConfigureLogging ¶
func ConfigureLogging(cfg *ServerConfig) error
ConfigureLogging configures logging.
Types ¶
type Config ¶
type Config struct { Server *ServerConfig `yaml:"server"` Prices PriceList `yaml:"prices"` Sources []*SourceConfig `yaml:"sources"` }
Config describes the top level config file format.
type PriceConfig ¶
type PriceConfig struct { Source string `yaml:"source"` Base string `yaml:"base"` BaseOverride string `yaml:"base_override"` Quote string `yaml:"quote"` QuoteOverride string `yaml:"quote_override"` Factor float64 `yaml:"factor"` Wander bool `yaml:"wander"` }
PriceConfig describes one price setting, which uses one source.
func (PriceConfig) String ¶
func (pc PriceConfig) String() string
type PriceList ¶ added in v0.2.0
type PriceList []PriceConfig
func (PriceList) GetBySource ¶ added in v0.2.0
type ServerConfig ¶
ServerConfig describes the settings for running the price proxy.
type SourceConfig ¶
type SourceConfig struct { Name string `yaml:"name"` URL url.URL `yaml:"url"` AuthKeyEnvName string `yaml:"auth_key_env_name"` SleepReal int `yaml:"sleepReal"` }
SourceConfig describes one source setting (e.g. one API endpoint). The URL has "{base}" and "{quote}" replaced at runtime with entries from PriceConfig.
func (SourceConfig) IsBitstamp ¶ added in v0.2.0
func (ps SourceConfig) IsBitstamp() bool
func (SourceConfig) IsCoinGecko ¶ added in v0.2.0
func (ps SourceConfig) IsCoinGecko() bool
func (SourceConfig) IsCoinMarketCap ¶ added in v0.2.0
func (ps SourceConfig) IsCoinMarketCap() bool
func (SourceConfig) String ¶
func (ps SourceConfig) String() string
Click to show internal directories.
Click to hide internal directories.