Skip to content

Commit

Permalink
Merge pull request #2803 from gobitfly/BIDS-2918/dedicated_session_st…
Browse files Browse the repository at this point in the history
…orage

(BIDS-2918) move session store to a dedicated redis instance
  • Loading branch information
recy21 authored Jan 9, 2024
2 parents a6bc16a + 96eade5 commit 71095bb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
17 changes: 9 additions & 8 deletions types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
2 changes: 1 addition & 1 deletion utils/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
}

Expand Down
5 changes: 5 additions & 0 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 71095bb

Please sign in to comment.