1
0
Fork 0
mirror of https://github.com/eosswedenorg/thalos synced 2026-08-28 20:38:13 +02:00

Merge pull request #17 from eosswedenorg/15-support-chain-names

support chain names
This commit is contained in:
Henrik Hautakoski 2023-05-15 15:33:08 +02:00 committed by GitHub
commit 2335dbc211
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View file

@ -30,6 +30,7 @@ type ShipConfig struct {
MaxMessagesInFlight uint32 `yaml:"max_messages_in_flight"` MaxMessagesInFlight uint32 `yaml:"max_messages_in_flight"`
StartBlockNum uint32 `yaml:"start_block_num"` StartBlockNum uint32 `yaml:"start_block_num"`
EndBlockNum uint32 `yaml:"end_block_num"` EndBlockNum uint32 `yaml:"end_block_num"`
Chain string `yaml:"chain"`
} }
type Config struct { type Config struct {

View file

@ -137,6 +137,13 @@ func init() {
log.SetFormatter(&formatter) log.SetFormatter(&formatter)
} }
func getChain(def string) string {
if len(conf.Ship.Chain) > 0 {
return conf.Ship.Chain
}
return def
}
func main() { func main() {
var err error var err error
var chainInfo *eos.InfoResp var chainInfo *eos.InfoResp
@ -255,7 +262,7 @@ func main() {
shClient, shClient,
api_redis.NewPublisher(rdb, api_redis.Namespace{ api_redis.NewPublisher(rdb, api_redis.Namespace{
Prefix: conf.Redis.Prefix, Prefix: conf.Redis.Prefix,
ChainID: chainInfo.ChainID.String(), ChainID: getChain(chainInfo.ChainID.String()),
}), }),
abi.NewAbiManager(rdb, eosClient, conf.Redis.CacheID), abi.NewAbiManager(rdb, eosClient, conf.Redis.CacheID),
codec, codec,

View file

@ -29,6 +29,10 @@ ship:
# Url to ship api. # Url to ship api.
url: "ws://127.0.0.1:8089" 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 # Fetch irreversible blocks only
# irreversible_only: true # irreversible_only: true