Permalink
Browse files

Allow setting name/pass as well as auth

  • Loading branch information...
1 parent 16c6665 commit 8a521bd040a4afb8a03f80ac58542434e23e7355 @isaacs isaacs committed Jul 10, 2012
Showing with 10 additions and 0 deletions.
  1. +10 −0 index.js
View
10 index.js
@@ -44,7 +44,17 @@ function RegClient (options) {
a = a.split(":")
this.username = a.shift()
this.password = a.join(":")
+ } else {
+ this.username = options.username
+ this.password = options.password
+
+ // if username and password are set, but auth isn't, use them.
+ if (this.username && this.password) {
+ var a = this.username + ":" + this.password
+ this.auth = new Buffer(a, "utf8").toString("base64")
+ }
}
+
this.email = options.email || null
this.defaultTag = options.tag || "latest"

0 comments on commit 8a521bd

Please sign in to comment.