From 83759392262845cfe5f926e6bd696ea432333e84 Mon Sep 17 00:00:00 2001 From: yutianwu Date: Wed, 21 Sep 2022 15:44:34 +0800 Subject: [PATCH] overwrite HTTPHost in config.toml via cli (#999) --- cmd/utils/flags.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 41582d1fde..376817356a 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1050,8 +1050,10 @@ func SplitAndTrim(input string) (ret []string) { // setHTTP creates the HTTP RPC listener interface string from the set // command line flags, returning empty if the HTTP endpoint is disabled. func setHTTP(ctx *cli.Context, cfg *node.Config) { - if ctx.GlobalBool(HTTPEnabledFlag.Name) && cfg.HTTPHost == "" { - cfg.HTTPHost = "127.0.0.1" + if ctx.GlobalBool(HTTPEnabledFlag.Name) { + if cfg.HTTPHost == "" { + cfg.HTTPHost = "127.0.0.1" + } if ctx.GlobalIsSet(HTTPListenAddrFlag.Name) { cfg.HTTPHost = ctx.GlobalString(HTTPListenAddrFlag.Name) }