Use coin specific coingecko api key
This commit is contained in:
parent
6a7c4e96ed
commit
8ac418b267
@ -59,7 +59,7 @@ type marketChartPrices struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewCoinGeckoDownloader creates a coingecko structure that implements the RatesDownloaderInterface
|
// NewCoinGeckoDownloader creates a coingecko structure that implements the RatesDownloaderInterface
|
||||||
func NewCoinGeckoDownloader(db *db.RocksDB, url string, coin string, platformIdentifier string, platformVsCurrency string, allowedVsCurrencies string, timeFormat string, metrics *common.Metrics, throttleDown bool) RatesDownloaderInterface {
|
func NewCoinGeckoDownloader(db *db.RocksDB, coinShortcut string, url string, coin string, platformIdentifier string, platformVsCurrency string, allowedVsCurrencies string, timeFormat string, metrics *common.Metrics, throttleDown bool) RatesDownloaderInterface {
|
||||||
throttlingDelayMs := 0 // No delay by default
|
throttlingDelayMs := 0 // No delay by default
|
||||||
if throttleDown {
|
if throttleDown {
|
||||||
throttlingDelayMs = DefaultThrottleDelayMs
|
throttlingDelayMs = DefaultThrottleDelayMs
|
||||||
@ -67,7 +67,10 @@ func NewCoinGeckoDownloader(db *db.RocksDB, url string, coin string, platformIde
|
|||||||
|
|
||||||
allowedVsCurrenciesMap := getAllowedVsCurrenciesMap(allowedVsCurrencies)
|
allowedVsCurrenciesMap := getAllowedVsCurrenciesMap(allowedVsCurrencies)
|
||||||
|
|
||||||
apiKey := os.Getenv("COINGECKO_API_KEY")
|
apiKey := os.Getenv(strings.ToUpper(coinShortcut) + "_COINGECKO_API_KEY")
|
||||||
|
if apiKey == "" {
|
||||||
|
apiKey = os.Getenv("COINGECKO_API_KEY")
|
||||||
|
}
|
||||||
|
|
||||||
// use default address if not overridden, with respect to existence of apiKey
|
// use default address if not overridden, with respect to existence of apiKey
|
||||||
if url == "" {
|
if url == "" {
|
||||||
|
|||||||
@ -108,7 +108,7 @@ func NewFiatRates(db *db.RocksDB, config *common.Config, metrics *common.Metrics
|
|||||||
// a small hack - in tests the callback is not used, therefore there is no delay slowing down the test
|
// a small hack - in tests the callback is not used, therefore there is no delay slowing down the test
|
||||||
throttle = false
|
throttle = false
|
||||||
}
|
}
|
||||||
fr.downloader = NewCoinGeckoDownloader(db, rdParams.URL, rdParams.Coin, rdParams.PlatformIdentifier, rdParams.PlatformVsCurrency, fr.allowedVsCurrencies, fr.timeFormat, metrics, throttle)
|
fr.downloader = NewCoinGeckoDownloader(db, db.GetInternalState().CoinShortcut, rdParams.URL, rdParams.Coin, rdParams.PlatformIdentifier, rdParams.PlatformVsCurrency, fr.allowedVsCurrencies, fr.timeFormat, metrics, throttle)
|
||||||
if is != nil {
|
if is != nil {
|
||||||
is.HasFiatRates = true
|
is.HasFiatRates = true
|
||||||
is.HasTokenFiatRates = fr.downloadTokens
|
is.HasTokenFiatRates = fr.downloadTokens
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user