From 7a4ffefc9320660e2da529e44b7acf70ed7db491 Mon Sep 17 00:00:00 2001 From: Scott Date: Wed, 22 May 2019 12:36:17 +1000 Subject: [PATCH] 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 --- config/config.go | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/config/config.go b/config/config.go index aaa8ef40742..9aa9e622521 100644 --- a/config/config.go +++ b/config/config.go @@ -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 {