@contrail/cli 1.0.12 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/auth/login.js CHANGED
@@ -91,22 +91,23 @@ export async function authUser() {
91
91
  });
92
92
  }
93
93
  async function setAuthContext(user, params) {
94
- // TODO Dont allow user to set this - they could set dev
95
- const questions = [];
96
- questions.push({
97
- type: 'list',
98
- name: 'environment',
99
- message: 'Which environment would you like to use?',
100
- choices: ['Dev', 'Prod'],
101
- default: 'Dev',
102
- });
94
+ const config = await getConfig();
103
95
  let apiGateway;
104
- const answers = await inquirer.prompt(questions);
105
- if (answers.environment === 'Dev') {
106
- apiGateway = 'https://api.vibeiq.com/dev/api';
96
+ console.log(config.environments);
97
+ if (config.environments) {
98
+ const questions = [];
99
+ questions.push({
100
+ type: 'list',
101
+ name: 'environment',
102
+ message: 'Which environment would you like to use?',
103
+ choices: Object.keys(config.environments),
104
+ default: Object.keys(config.environments)[0],
105
+ });
106
+ const answers = await inquirer.prompt(questions);
107
+ apiGateway = config.environments[answers.environment];
107
108
  }
108
109
  else {
109
- apiGateway = 'https://api.dev.vibeiq.com/dev/api';
110
+ apiGateway = 'https://api.vibeiq.com/prod/api';
110
111
  }
111
112
  // Set Auth Config
112
113
  Auth.config = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/cli",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "VibeIQ's Contrail Platform CLI.",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
package/src/auth/login.ts CHANGED
@@ -103,23 +103,22 @@ export async function authUser(): Promise<AuthContext> {
103
103
  }
104
104
 
105
105
  async function setAuthContext(user, params): Promise<AuthContext> {
106
-
107
- // TODO Dont allow user to set this - they could set dev
108
- const questions = [];
109
- questions.push({
110
- type: 'list',
111
- name: 'environment',
112
- message: 'Which environment would you like to use?',
113
- choices: ['Dev', 'Prod'],
114
- default: 'Dev',
115
- });
116
-
106
+ const config = await getConfig();
117
107
  let apiGateway;
118
- const answers = await inquirer.prompt(questions);
119
- if (answers.environment === 'Dev') {
120
- apiGateway = 'https://api.vibeiq.com/dev/api';
108
+ console.log(config.environments)
109
+ if(config.environments) {
110
+ const questions = [];
111
+ questions.push({
112
+ type: 'list',
113
+ name: 'environment',
114
+ message: 'Which environment would you like to use?',
115
+ choices: Object.keys(config.environments),
116
+ default: Object.keys(config.environments)[0],
117
+ });
118
+ const answers = await inquirer.prompt(questions);
119
+ apiGateway = config.environments[answers.environment]
121
120
  } else {
122
- apiGateway = 'https://api.dev.vibeiq.com/dev/api';
121
+ apiGateway = 'https://api.vibeiq.com/prod/api';
123
122
  }
124
123
 
125
124
  // Set Auth Config