Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trim whitespace when reading FLY_ACCESS_TOKEN #892

Merged
merged 1 commit into from
Apr 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package config

import (
"strings"
"sync"

"github.com/spf13/pflag"
Expand Down Expand Up @@ -85,6 +86,9 @@ func (cfg *Config) ApplyEnv() {
cfg.AccessToken = env.FirstOrDefault(cfg.AccessToken,
AccessTokenEnvKey, APITokenEnvKey)

// trim whitespace since it causes http errors when passsed to Docker auth
cfg.AccessToken = strings.TrimSpace(cfg.AccessToken)

cfg.VerboseOutput = env.IsTruthy(verboseOutputEnvKey) || cfg.VerboseOutput
cfg.JSONOutput = env.IsTruthy(jsonOutputEnvKey) || cfg.JSONOutput
cfg.LogGQLErrors = env.IsTruthy(logGQLEnvKey) || cfg.LogGQLErrors
Expand Down