Skip to content
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

fix: [index] Api Keys should be changed, and switched according to env #127

Merged
merged 1 commit into from May 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/commands/console/index.js
Expand Up @@ -19,24 +19,26 @@ const { CLI } = require('@adobe/aio-lib-ims/src/context')
const Help = require('@oclif/plugin-help').default
const yaml = require('js-yaml')

const { CONSOLE_API_KEY = 'TransporterJaeger1' } = process.env
const DEFAULT_ENV = 'prod'
const API_KEYS = {
prod: 'aio-cli-console-auth',
stage: 'aio-cli-console-auth-stage'
}

const ORG_TYPE_ENTERPRISE = 'entp'
const CONSOLE_CONFIG_KEY = '$console'

class ConsoleCommand extends Command {
constructor (argv, config) {
super(argv, config)
this.apiKey = CONSOLE_API_KEY
}

async run () {
const help = new Help(this.config)
help.showHelp(['console', '--help'])
}

async initSdk () {
const currConfig = await context.getCli()
this.imsEnv = (currConfig && currConfig.env) || 'prod'
this.imsEnv = (currConfig && currConfig.env) || DEFAULT_ENV
this.apiKey = API_KEYS[this.imsEnv]

await context.setCli({ '$cli.bare-output': true }, false) // set this globally
aioConsoleLogger.debug('Retrieving Auth Token')
this.accessToken = await getToken(CLI)
Expand Down