From 96eade59afa7d8a8eeada818849d5995f2f6d18e Mon Sep 17 00:00:00 2001 From: peter <1674920+peterbitfly@users.noreply.github.com> Date: Mon, 8 Jan 2024 14:09:39 +0100 Subject: [PATCH] (BIDS-2918) move session store to a dedicated redis instance --- types/config.go | 17 +++++++++-------- utils/session.go | 2 +- utils/utils.go | 5 +++++ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/types/config.go b/types/config.go index fd94943169..f2be6bd17b 100644 --- a/types/config.go +++ b/types/config.go @@ -55,14 +55,15 @@ type Config struct { ClConfig ClChainConfig ElConfig *params.ChainConfig } `yaml:"chain"` - Eth1ErigonEndpoint string `yaml:"eth1ErigonEndpoint" envconfig:"ETH1_ERIGON_ENDPOINT"` - Eth1GethEndpoint string `yaml:"eth1GethEndpoint" envconfig:"ETH1_GETH_ENDPOINT"` - EtherscanAPIKey string `yaml:"etherscanApiKey" envconfig:"ETHERSCAN_API_KEY"` - EtherscanAPIBaseURL string `yaml:"etherscanApiBaseUrl" envconfig:"ETHERSCAN_API_BASEURL"` - RedisCacheEndpoint string `yaml:"redisCacheEndpoint" envconfig:"REDIS_CACHE_ENDPOINT"` - TieredCacheProvider string `yaml:"tieredCacheProvider" envconfig:"CACHE_PROVIDER"` - ReportServiceStatus bool `yaml:"reportServiceStatus" envconfig:"REPORT_SERVICE_STATUS"` - Indexer struct { + Eth1ErigonEndpoint string `yaml:"eth1ErigonEndpoint" envconfig:"ETH1_ERIGON_ENDPOINT"` + Eth1GethEndpoint string `yaml:"eth1GethEndpoint" envconfig:"ETH1_GETH_ENDPOINT"` + EtherscanAPIKey string `yaml:"etherscanApiKey" envconfig:"ETHERSCAN_API_KEY"` + EtherscanAPIBaseURL string `yaml:"etherscanApiBaseUrl" envconfig:"ETHERSCAN_API_BASEURL"` + RedisCacheEndpoint string `yaml:"redisCacheEndpoint" envconfig:"REDIS_CACHE_ENDPOINT"` + RedisSessionStoreEndpoint string `yaml:"redisSessionStoreEndpoint" envconfig:"REDIS_SESSION_STORE_ENDPOINT"` + TieredCacheProvider string `yaml:"tieredCacheProvider" envconfig:"CACHE_PROVIDER"` + ReportServiceStatus bool `yaml:"reportServiceStatus" envconfig:"REPORT_SERVICE_STATUS"` + Indexer struct { Enabled bool `yaml:"enabled" envconfig:"INDEXER_ENABLED"` Node struct { Port string `yaml:"port" envconfig:"INDEXER_NODE_PORT"` diff --git a/utils/session.go b/utils/session.go index 7096940898..deba31b632 100644 --- a/utils/session.go +++ b/utils/session.go @@ -88,7 +88,7 @@ func InitSessionStore(secret string) { pool := &redis.Pool{ MaxIdle: 10, Dial: func() (redis.Conn, error) { - return redis.Dial("tcp", Config.RedisCacheEndpoint) + return redis.Dial("tcp", Config.RedisSessionStoreEndpoint) }, } diff --git a/utils/utils.go b/utils/utils.go index cc1b779f2e..480f084481 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -790,6 +790,11 @@ func ReadConfig(cfg *types.Config, path string) error { cfg.Chain.Id = cfg.Chain.ClConfig.DepositChainID + if cfg.RedisSessionStoreEndpoint == "" && cfg.RedisCacheEndpoint != "" { + logrus.Infof("using RedisCacheEndpoint %s as RedisSessionStoreEndpoint as no dedicated RedisSessionStoreEndpoint was provided", cfg.RedisCacheEndpoint) + cfg.RedisSessionStoreEndpoint = cfg.RedisCacheEndpoint + } + logrus.WithFields(logrus.Fields{ "genesisTimestamp": cfg.Chain.GenesisTimestamp, "genesisValidatorsRoot": cfg.Chain.GenesisValidatorsRoot,