Update flags.go

This commit is contained in:
Felix Lange 2023-12-12 13:05:43 +01:00 committed by GitHub
parent 1a1fb9174d
commit 5c0b964fd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1089,7 +1089,9 @@ func SplitAndTrim(input string) (ret []string) {
// command line flags, returning empty if the HTTP endpoint is disabled.
func setHTTP(ctx *cli.Context, cfg *node.Config) {
if ctx.Bool(HTTPEnabledFlag.Name) {
cfg.HTTPHost = "127.0.0.1"
if cfg.HTTPHost == "" {
cfg.HTTPHost = "127.0.0.1"
}
if ctx.IsSet(HTTPListenAddrFlag.Name) {
cfg.HTTPHost = ctx.String(HTTPListenAddrFlag.Name)
}
@ -1154,7 +1156,9 @@ func setGraphQL(ctx *cli.Context, cfg *node.Config) {
// command line flags, returning empty if the HTTP endpoint is disabled.
func setWS(ctx *cli.Context, cfg *node.Config) {
if ctx.Bool(WSEnabledFlag.Name) {
cfg.WSHost = "127.0.0.1"
if cfg.WSHost == "" {
cfg.WSHost = "127.0.0.1"
}
if ctx.IsSet(WSListenAddrFlag.Name) {
cfg.WSHost = ctx.String(WSListenAddrFlag.Name)
}