diff --git a/index.ts b/index.ts index bbb249e7..d6dff87f 100755 --- a/index.ts +++ b/index.ts @@ -828,7 +828,7 @@ commander console.log(e); }); }); - }, true); + }); }); /** diff --git a/src/auth.ts b/src/auth.ts index 5306182f..ca2a337a 100644 --- a/src/auth.ts +++ b/src/auth.ts @@ -21,15 +21,19 @@ export const oauth2Client = new OAuth2Client({ * @param {Function} cb The callback * @param {boolean} isLocal If we should load local API credentials for this clasp project. */ -export function getAPICredentials(cb: (rc: ClaspSettings | void) => void, isLocal?: boolean) { - const dotfile = isLocal ? DOTFILE.RC_LOCAL : DOTFILE.RC; - dotfile.read().then((rc: ClaspSettings) => { +export function getAPICredentials(cb: (rc: ClaspSettings | void) => void) { + DOTFILE.RC_LOCAL.read().then((rc: ClaspSettings) => { oauth2Client.setCredentials(rc); cb(rc); }).catch((err: object) => { - console.error('Could not read API credentials. Error:'); - console.error(err); - process.exit(-1); + DOTFILE.RC.read().then((rc: ClaspSettings) => { + oauth2Client.setCredentials(rc); + cb(rc); + }).catch((err: object) => { + console.error('Could not read API credentials. Error:'); + console.error(err); + process.exit(-1); + }); }); }