Documentation ¶
Overview ¶
Package config provides configuration for client apps based on the Cryptowatch SDK.
Index ¶
Constants ¶
View Source
const ( DefaultRESTURL = "https://api.cryptowat.ch" DefaultStreamURL = "wss://stream.cryptowat.ch" DefaultTradeURL = "wss://trading.service.cryptowat.ch" Filepath = ".cw/credentials.yml" )
Default URLs used if one of the URLs isn't specified.
Variables ¶
View Source
var ( ErrNilConfig = Error{Type: "config", Why: "config is nil", How: "create and load config first"} ErrEmptyAPIKey = Error{Type: "config", What: "api_url", Why: "is empty", How: "specify an api_key"} ErrEmptySecretKey = Error{Type: "config", What: "secret_key", Why: "is empty", How: "specify a secret_key"} ErrInvalidHTTPURL = Error{Type: "config", Why: "wrong url", How: "URL must be a valid http or https url"} ErrInvalidWSURL = Error{Type: "config", Why: "wrong url", How: "URL must be a valid ws or wss url"} ErrInvalidScheme = Error{Type: "config", Why: "invalid scheme", How: "scheme must be http(s) or ws(s)"} ErrNilArgs = Error{Type: "args", Why: "args is nil", How: "create an instance of args"} )
Various validation errors.
Functions ¶
func DefaultFilepath ¶
DefaultFilepath determines and returns default config path. It can return an error if detecting the user's home directory has failed.
Types ¶
type CWConfig ¶
type CWConfig struct { APIKey string `yaml:"api_key"` SecretKey string `yaml:"secret_key"` RESTURL string `yaml:"rest_url"` StreamURL string `yaml:"stream_url"` TradeURL string `yaml:"trade_url"` // contains filtered or unexported fields }
CWConfig holds the configuration.
func NewFromPath ¶
NewFromPath creates a new CW from a file by the given path.
Click to show internal directories.
Click to hide internal directories.