From 5d0bb25572cb70f2e37453ef4142b1cd66449e11 Mon Sep 17 00:00:00 2001 From: Devin Carr Date: Thu, 6 Apr 2023 10:08:02 -0700 Subject: [PATCH] TUN-7354: Don't warn for empty ingress rules when using --token --- ingress/ingress.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ingress/ingress.go b/ingress/ingress.go index c05713c8..56b3b1e7 100644 --- a/ingress/ingress.go +++ b/ingress/ingress.go @@ -94,7 +94,7 @@ func ParseIngress(conf *config.Configuration) (Ingress, error) { // ParseIngressFromConfigAndCLI will parse the configuration rules from config files for ingress // rules and then attempt to parse CLI for ingress rules. // Will always return at least one valid ingress rule. If none are provided by the user, the default -// will be to return 502 status code for all incoming requests. +// will be to return 503 status code for all incoming requests. func ParseIngressFromConfigAndCLI(conf *config.Configuration, c *cli.Context, log *zerolog.Logger) (Ingress, error) { // Attempt to parse ingress rules from configuration ingressRules, err := ParseIngress(conf) @@ -110,7 +110,11 @@ func ParseIngressFromConfigAndCLI(conf *config.Configuration, c *cli.Context, lo // --bastion for ssh bastion service ingressRules, err = parseCLIIngress(c, false) if errors.Is(err, ErrNoIngressRulesCLI) { - log.Warn().Msgf(ErrNoIngressRulesCLI.Error()) + // Only log a warning if the tunnel is not a remotely managed tunnel and the config + // will be loaded after connecting. + if !c.IsSet("token") { + log.Warn().Msgf(ErrNoIngressRulesCLI.Error()) + } return newDefaultOrigin(c, log), nil } if err != nil {