From e0f7e3b4e9bcfe6cb7beb7172df8fba81ae57d09 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Mon, 15 May 2023 15:28:38 +0200 Subject: [PATCH 1/2] app/config/config.go: Adding ShipConfig.Chain --- app/config/config.go | 1 + config.example.yml | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/app/config/config.go b/app/config/config.go index ec95169..c09b27f 100644 --- a/app/config/config.go +++ b/app/config/config.go @@ -30,6 +30,7 @@ type ShipConfig struct { MaxMessagesInFlight uint32 `yaml:"max_messages_in_flight"` StartBlockNum uint32 `yaml:"start_block_num"` EndBlockNum uint32 `yaml:"end_block_num"` + Chain string `yaml:"chain"` } type Config struct { diff --git a/config.example.yml b/config.example.yml index 1bf5ff0..caf4a10 100644 --- a/config.example.yml +++ b/config.example.yml @@ -29,6 +29,10 @@ ship: # Url to ship api. url: "ws://127.0.0.1:8089" + # Name of chain. Note that this is just a name to be used in channel namespace. + # If unset, chain id from api is used. + # chain: wax + # Fetch irreversible blocks only # irreversible_only: true From ac57e82992f422b179a4c25f35b04ec8de63bfaf Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Mon, 15 May 2023 15:29:31 +0200 Subject: [PATCH 2/2] cmd/thalos/main.go: use conf.Ship.Chain if set as namespace. otherwise default to chain id from api. --- cmd/thalos/main.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/thalos/main.go b/cmd/thalos/main.go index cdb13a1..8b586a0 100644 --- a/cmd/thalos/main.go +++ b/cmd/thalos/main.go @@ -106,6 +106,13 @@ func init() { log.SetFormatter(&formatter) } +func getChain(def string) string { + if len(conf.Ship.Chain) > 0 { + return conf.Ship.Chain + } + return def +} + func main() { var err error var chainInfo *eos.InfoResp @@ -224,7 +231,7 @@ func main() { shClient, api_redis.NewPublisher(rdb, api_redis.Namespace{ Prefix: conf.Redis.Prefix, - ChainID: chainInfo.ChainID.String(), + ChainID: getChain(chainInfo.ChainID.String()), }), abi.NewAbiManager(rdb, eosClient, conf.Redis.CacheID), codec,