-
Notifications
You must be signed in to change notification settings - Fork 127
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
feat/provider: read .scwrc #111
Conversation
50fd595
to
d26e19e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @nicolai86
Thanks for this PR - taking a look through this mostly LGTM, if we can address the comments this otherwise should be good 👍
Thanks!
scaleway/provider.go
Outdated
defer f.Close() | ||
|
||
var data scalewayConfig | ||
err = json.NewDecoder(f).Decode(&data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if there's an error parsing this should we also return:
err = json.NewDecoder(f).Decode(&data) | |
err = json.NewDecoder(f).Decode(&data) | |
if err != nil { | |
return "", "", err | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, I'll update this
scaleway/provider.go
Outdated
if apiKey == "" { | ||
if path, err := homedir.Expand(d.Get(".scwrc").(string)); err == nil { | ||
scwAPIKey, scwOrganization, err := readScalewayConfig(path) | ||
if err == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we invert this and raise this error?
if err == nil { | |
if err != nil { | |
return fmt.Errorf("Error loading credentials from SCW: %s", err) | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a miss, yes it should be inverted
d26e19e
to
e458fc6
Compare
e458fc6
to
83386ca
Compare
83386ca
to
8902a29
Compare
Ran all the tests over night, without setting environment variables - they all passed. Will pull this in :) |
once merged, the provider will fallback to scaleways ~/.scwrc to get
access credentials.
closes #104