From 63579ca64aee3543bbe7b6fd392d37ada5c261b3 Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Mon, 23 May 2022 10:07:50 -0500 Subject: [PATCH] feat: cli configs should not be space sensitive If you edit the file and add a newline, it breaks. It should not matter --- cli/root.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cli/root.go b/cli/root.go index 00c7b6f0ce531..909176f48ba49 100644 --- a/cli/root.go +++ b/cli/root.go @@ -4,6 +4,7 @@ import ( "fmt" "net/url" "os" + "strings" "time" "github.com/kirsle/configdir" @@ -115,7 +116,7 @@ func createClient(cmd *cobra.Command) (*codersdk.Client, error) { return nil, err } } - serverURL, err := url.Parse(rawURL) + serverURL, err := url.Parse(strings.TrimSpace(rawURL)) if err != nil { return nil, err } @@ -127,7 +128,7 @@ func createClient(cmd *cobra.Command) (*codersdk.Client, error) { } } client := codersdk.New(serverURL) - client.SessionToken = token + client.SessionToken = strings.TrimSpace(token) return client, nil }