From e45f3f376b179ee9ca42557165724b54c74afdf4 Mon Sep 17 00:00:00 2001 From: yutianwu Date: Mon, 18 Jul 2022 19:42:14 +0800 Subject: [PATCH] overwrite HTTPHost in config.toml via cli --- 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 378a06898b..224885ea60 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) }