-
Notifications
You must be signed in to change notification settings - Fork 12
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
add registerToken support #17
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ var gcr = require('../lib/gcr') | |
, sslcert: path | ||
, sslkey: path | ||
, cacert: path | ||
, registerToken: String | ||
} | ||
, shortHand = { verbose: ['--loglevel', 'verbose'] | ||
, h: ['--help'] | ||
|
@@ -38,6 +39,7 @@ var gcr = require('../lib/gcr') | |
, C: ['--sslcert'] | ||
, K: ['--sslkey'] | ||
, A: ['--cacert'] | ||
, r: ['--registerToken'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix spacing to align with the others |
||
} | ||
, parsed = nopt(knownOpts, shortHand) | ||
|
||
|
@@ -110,6 +112,31 @@ gcr.load(parsed, function(err) { | |
|
||
if (!gcr.config.get('token')) { | ||
questions.push(tokenQuestion) | ||
if (!gcr.config.get('registerToken')) { | ||
questions.push(tokenQuestion) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If |
||
} else { | ||
var fp = gcr.config.get('keypath') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please use 2 spaces instead of tabs to match up with the rest of the repository. I'll have to see about getting this added to the linting rules, but i don't know about lilint. @evanlucas? |
||
fs.readFile(fp, 'utf8', function(err, content) { | ||
if (err) { | ||
log.error('[readFile]', 'error reading public key', err) | ||
process.exit(1) | ||
} | ||
gcr.client.registerRunner(content | ||
, gcr.config.get('registerToken') | ||
, function(err, token) { | ||
if (err) { | ||
log.error('[register]', 'error registering', err) | ||
process.exit(1) | ||
} else { | ||
gcr.config.set('token', token) | ||
gcr.config.save(function(err) { | ||
if (err) throw err | ||
}) | ||
} | ||
}) | ||
}) | ||
} | ||
needsRegToken = true | ||
} | ||
|
||
if (questions.length) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ module.exports = function(parsed) { | |
const o = {} | ||
if (parsed.url) o.url = parsed.url | ||
if (parsed.token) o.token = parsed.token | ||
if (parsed.registToken) o.registToken = parsed.registerToken | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if (parsed.buildDir) o.buildDir = parsed.buildDir | ||
if (parsed.npm) o.npm = parsed.npm | ||
if (parsed.timeout) o.timeout = parsed.timeout | ||
|
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.
Fix spacing to align with the others