-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathconfigure.js
27 lines (23 loc) · 1.15 KB
/
configure.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const path = require('path')
const BaseCommand = require('../support/command/base-command')
const inquirer = require('inquirer')
const { getPrompts } = require('../support/inquirer')
const { setConfig, getConfig } = require('../config')
class ConfigureCommand extends BaseCommand {
async run() {
const prompts = getPrompts(['swaggerHubUrl','apiKey'])(getConfig())
const { configDir } = this.config
const configFilePath = [...configDir.split(path.sep), 'config.json'].join(path.sep)
return inquirer.prompt(prompts)
.then(setConfig)
.then(this.logCommandSuccess({ configFilePath }))
.catch(this.throwCommandError({ configFilePath }))
}
}
ConfigureCommand.description = `configure application settings
Enter the SwaggerHub URL - default is https://api.swaggerhub.com
Customers with on-premise installations need to point this to their on-premise API, which is http(s)://{swaggerhub-host}/v1
Enter the API Key - this can be retrieved from https://app.swaggerhub.com/settings/apiKey
You can set these as environment variables: SWAGGERHUB_URL, SWAGGERHUB_API_KEY. These take priority over config settings.
`
module.exports = ConfigureCommand