From 13d15b0715f76df3968b72d05c54cc264dd6d786 Mon Sep 17 00:00:00 2001 From: goalongway Date: Thu, 1 Aug 2024 09:26:22 +0800 Subject: [PATCH] modify --- serv/internal/config/config.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/serv/internal/config/config.go b/serv/internal/config/config.go index dafcbbce..5af5a2dc 100644 --- a/serv/internal/config/config.go +++ b/serv/internal/config/config.go @@ -158,13 +158,15 @@ func LoadConfig() AppConfig { if err := v.Unmarshal(&config); err != nil { panic(err) } - var blockchains []Blockchain + blockchainsJson := v.GetString("BLOCKCHAINS") - err = json.Unmarshal([]byte(blockchainsJson), &blockchains) - if err != nil { - panic(err) + if blockchainsJson != "" { + var blockchains []Blockchain + err = json.Unmarshal([]byte(blockchainsJson), &blockchains) + if err != nil { + panic(err) + } + config.Blockchain = blockchains } - config.Blockchain = blockchains - return config }