-
Notifications
You must be signed in to change notification settings - Fork 2k
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
expose config credentials without needing the Cli #227
Conversation
Codecov Report
@@ Coverage Diff @@
## master #227 +/- ##
==========================================
+ Coverage 46.85% 46.98% +0.13%
==========================================
Files 172 172
Lines 11692 11693 +1
==========================================
+ Hits 5478 5494 +16
+ Misses 5902 5882 -20
- Partials 312 317 +5 |
cli/config/config.go
Outdated
func LoadDefaultConfigFile(err io.Writer) *configfile.ConfigFile { | ||
configFile, e := Load(Dir()) | ||
if e != nil { | ||
fmt.Fprintf(err, "WARNING: Error loading config file:%v\n", e) |
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.
I realize this code is only moved, but it looks like a space is missing between :
and %v
.
Fixed the string format and added a couple more unit tests. |
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.
LGTM
cli/config/configfile/file.go
Outdated
@@ -53,6 +53,15 @@ type ProxyConfig struct { | |||
FTPProxy string `json:"ftpProxy,omitempty"` | |||
} | |||
|
|||
// NewConfigFile initializes an empty configuration file for the given filename 'fn' | |||
func NewConfigFile(fn string) *ConfigFile { |
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.
nit: maybe in the context of this pkg it should just be called New
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.
LGTM 🦁 with @tonistiigi comment 👼
Given that @dnephin is on PTO this week, perhaps someone can carry those nits? |
I'll carry this one 😉 |
Signed-off-by: Daniel Nephin <[email protected]>
Signed-off-by: Daniel Nephin <[email protected]>
Signed-off-by: Daniel Nephin <[email protected]>
Signed-off-by: Daniel Nephin <[email protected]>
379623e
to
fda6366
Compare
Signed-off-by: Vincent Demeester <[email protected]>
fda6366
to
105b21d
Compare
expected := types.AuthConfig{ | ||
Username: "foo", | ||
Password: "bar", | ||
Email: "[email protected]", |
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.
Do we still have to test for the Email
field here?
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.
Maybe not but could be handled in a follow-up 👼
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 the credential helper stores email, I think we should still test for it.
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.
had one question, but LGTM overall
ping @tonistiigi PTAL
@vdemeester thanks for making that |
Related to moby/moby#30817
Move
GetAllCredentials()
, andCredentialsStore()
from theDockerCli
to theConfigFile
struct, so that are easier to use externally.