localbitcoins fixes (#177)

* General LocalBitcoin fixes

* Added override variables to config for exchange packages to allow different API URL's
This commit is contained in:
soxipy
2018-08-27 07:19:29 +03:00
committed by Ryan O'Hara-Reid
parent ca0c22f422
commit fb4e2d1452
35 changed files with 885 additions and 355 deletions

View File

@@ -54,6 +54,7 @@ const (
WarningExchangeAuthAPIDefaultOrEmptyValues = "WARNING -- Exchange %s: Authenticated API support disabled due to default/empty APIKey/Secret/ClientID values."
WarningCurrencyExchangeProvider = "WARNING -- Currency exchange provider invalid valid. Reset to Fixer."
WarningPairsLastUpdatedThresholdExceeded = "WARNING -- Exchange %s: Last manual update of available currency pairs has exceeded %d days. Manual update required!"
APIURLDefaultMessage = "NON_DEFAULT_HTTP_LINK_TO_EXCHANGE_API"
)
// Variables here are used for configuration
@@ -123,6 +124,8 @@ type ExchangeConfig struct {
APIKey string `json:"apiKey"`
APISecret string `json:"apiSecret"`
APIAuthPEMKey string `json:"apiAuthPemKey,omitempty"`
APIURL string `json:"apiUrl"`
APIURLSecondary string `json:"apiUrlSecondary"`
ClientID string `json:"clientId,omitempty"`
AvailablePairs string `json:"availablePairs"`
EnabledPairs string `json:"enabledPairs"`
@@ -618,6 +621,20 @@ func (c *Config) CheckExchangeConfigValues() error {
c.Exchanges[i].Name = "CoinbasePro"
}
if exch.APIURL != APIURLDefaultMessage {
if exch.APIURL == "" {
// Set default if nothing set
c.Exchanges[i].APIURL = APIURLDefaultMessage
}
}
if exch.APIURLSecondary != APIURLDefaultMessage {
if exch.APIURLSecondary == "" {
// Set default if nothing set
c.Exchanges[i].APIURLSecondary = APIURLDefaultMessage
}
}
if exch.Enabled {
if exch.Name == "" {
return fmt.Errorf(ErrExchangeNameEmpty, i)