Skip to content
This repository has been archived by the owner on Aug 10, 2020. It is now read-only.

Commit

Permalink
add docs to function
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidWells committed Jul 16, 2019
1 parent 5b080b3 commit d325599
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class BaseCommand extends Command {
const projectRoot = findRoot(process.cwd())
// Grab netlify API token
const token = getConfigToken()

// Get site config from netlify.toml
const configPath = getConfigPath(projectRoot)
// TODO: https://github.com/request/caseless to handle key casing issues
Expand Down Expand Up @@ -72,8 +71,8 @@ class BaseCommand extends Command {
}
}

async authenticate(authToken) {
const token = getConfigToken(authToken)
async authenticate(authTokenFromFlag) {
const token = getConfigToken(authTokenFromFlag)
if (!token) {
return this.expensivelyAuthenticate()
} else {
Expand Down Expand Up @@ -147,6 +146,11 @@ class BaseCommand extends Command {
}
}

/**
* Get user netlify API token
* @param {string} authTokenFromFlag - value passed in by CLI flag
* @return {string} - resolved Netlify API token
*/
function getConfigToken(authTokenFromFlag) {
// 1. First honor command flag --auth
if (authTokenFromFlag) {
Expand Down

0 comments on commit d325599

Please sign in to comment.