Skip to content

Commit

Permalink
Trim whitespace in API key file (#327)
Browse files Browse the repository at this point in the history
Many editors insert newlines automatically, so we need to trim the api key from the file before we try to use it.
  • Loading branch information
nalabelle authored Nov 14, 2024
1 parent 17e1c08 commit 7d1af01
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func LoadConfig(flags *flag.FlagSet) (*Config, error) {
return nil, fmt.Errorf("Couldn't Read API Key file %w", err)
}

if err := k.Set("api-key", string(data)); err != nil {
if err := k.Set("api-key", strings.TrimSpace(string(data))); err != nil {
return nil, fmt.Errorf("Couldn't merge api-key into config: %w", err)
}
}
Expand Down

0 comments on commit 7d1af01

Please sign in to comment.