Config: Fix AuthenticatedAPISupport default values check (#306)

* Fixes issue where first if statement always gets hit

* fmtimport

* Slightly more granular checks for keys, secret keys and clientids

* Moves log warn and removes extra checks
This commit is contained in:
Scott
2019-05-22 12:36:17 +10:00
committed by Adrian Gallagher
parent c08222699c
commit 7a4ffefc93

View File

@@ -799,16 +799,22 @@ func (c *Config) CheckExchangeConfigValues() error {
return fmt.Errorf(ErrExchangeBaseCurrenciesEmpty, c.Exchanges[i].Name)
}
if c.Exchanges[i].AuthenticatedAPISupport { // non-fatal error
if c.Exchanges[i].APIKey == "" || c.Exchanges[i].APISecret == "" ||
c.Exchanges[i].APIKey == DefaultUnsetAPIKey ||
c.Exchanges[i].APISecret == DefaultUnsetAPISecret {
if c.Exchanges[i].APIKey == "" || c.Exchanges[i].APIKey == DefaultUnsetAPIKey {
c.Exchanges[i].AuthenticatedAPISupport = false
}
if (c.Exchanges[i].APISecret == "" || c.Exchanges[i].APISecret == DefaultUnsetAPISecret) &&
c.Exchanges[i].Name != "COINUT" {
c.Exchanges[i].AuthenticatedAPISupport = false
}
if (c.Exchanges[i].ClientID == "ClientID" || c.Exchanges[i].ClientID == "") &&
(c.Exchanges[i].Name == "ITBIT" || c.Exchanges[i].Name == "Bitstamp" || c.Exchanges[i].Name == "COINUT" || c.Exchanges[i].Name == "CoinbasePro") {
c.Exchanges[i].AuthenticatedAPISupport = false
}
if !c.Exchanges[i].AuthenticatedAPISupport {
log.Warnf(WarningExchangeAuthAPIDefaultOrEmptyValues, c.Exchanges[i].Name)
} else if c.Exchanges[i].Name == "ITBIT" || c.Exchanges[i].Name == "Bitstamp" || c.Exchanges[i].Name == "COINUT" || c.Exchanges[i].Name == "CoinbasePro" {
if c.Exchanges[i].ClientID == "" || c.Exchanges[i].ClientID == "ClientID" {
c.Exchanges[i].AuthenticatedAPISupport = false
log.Warnf(WarningExchangeAuthAPIDefaultOrEmptyValues, c.Exchanges[i].Name)
}
}
}
if !c.Exchanges[i].SupportsAutoPairUpdates {