diff --git a/cmd/cloudflared/tunnel/cmd.go b/cmd/cloudflared/tunnel/cmd.go index deddd27f..25347c7b 100644 --- a/cmd/cloudflared/tunnel/cmd.go +++ b/cmd/cloudflared/tunnel/cmd.go @@ -400,7 +400,7 @@ func Commands() []*cli.Command { Upon connecting, you are assigned a unique subdomain on cftunnel.com. You need to specify a hostname on a zone you control. A DNS record will be created to CNAME your hostname to the unique subdomain on cftunnel.com. - + Requests made to Cloudflare's servers for your hostname will be proxied through the tunnel to your local webserver.`, Subcommands: cmds, @@ -430,11 +430,6 @@ func StartServer(c *cli.Context, version string, shutdownC, graceShutdownC chan logger.Warnf("Cannot determine default configuration path. No file %v in %v", defaultConfigFiles, config.DefaultConfigDirs) } - // check whether client provides enough flags or env variables. If not, print help. - if ok := enoughOptionsSet(c); !ok { - return nil - } - if err := configMainLogger(c); err != nil { return errors.Wrap(err, "Error configuring logger") } diff --git a/cmd/cloudflared/tunnel/configuration.go b/cmd/cloudflared/tunnel/configuration.go index b32ebf09..fd43146e 100644 --- a/cmd/cloudflared/tunnel/configuration.go +++ b/cmd/cloudflared/tunnel/configuration.go @@ -58,24 +58,6 @@ func generateRandomClientID() string { return hex.EncodeToString(id) } -func enoughOptionsSet(c *cli.Context) bool { - // For cloudflared to work, the user needs to at least provide a hostname, - // or runs as stand alone DNS proxy . - // When using sudo, use -E flag to preserve env vars - if c.NumFlags() == 0 && c.NArg() == 0 && os.Getenv("TUNNEL_HOSTNAME") == "" && os.Getenv("TUNNEL_DNS") == "" { - if isRunningFromTerminal() { - logger.Errorf("No arguments were provided. You need to at least specify the hostname for this tunnel. See %s", quickStartUrl) - logger.Infof("If you want to run Argo Tunnel client as a stand alone DNS proxy, run with --proxy-dns option or set TUNNEL_DNS environment variable.") - } else { - logger.Errorf("You need to specify all the options in a configuration file, or use environment variables. See %s and %s", serviceUrl, argumentsUrl) - logger.Infof("If you want to run Argo Tunnel client as a stand alone DNS proxy, specify proxy-dns option in the configuration file, or set TUNNEL_DNS environment variable.") - } - cli.ShowAppHelp(c) - return false - } - return true -} - func handleDeprecatedOptions(c *cli.Context) error { // Fail if the user provided an old authentication method if c.IsSet("api-key") || c.IsSet("api-email") || c.IsSet("api-ca-key") { diff --git a/validation/validation.go b/validation/validation.go index 746bf9c0..be254419 100644 --- a/validation/validation.go +++ b/validation/validation.go @@ -15,7 +15,7 @@ var supportedProtocol = [2]string{"http", "https"} func ValidateHostname(hostname string) (string, error) { if hostname == "" { - return "", fmt.Errorf("Hostname should not be empty") + return "", nil } // users gives url(contains schema) not just hostname if strings.Contains(hostname, ":") || strings.Contains(hostname, "%3A") { diff --git a/validation/validation_test.go b/validation/validation_test.go index 49a2cf10..3cd4cbd2 100644 --- a/validation/validation_test.go +++ b/validation/validation_test.go @@ -10,7 +10,7 @@ import ( func TestValidateHostname(t *testing.T) { var inputHostname string hostname, err := ValidateHostname(inputHostname) - assert.Equal(t, err, fmt.Errorf("Hostname should not be empty")) + assert.Equal(t, err, nil) assert.Empty(t, hostname) inputHostname = "hello.example.com"