1 | const cli = require('heroku-cli-util')
|
2 | const co = require('co')
|
3 | const api = require('../../lib/heroku-api')
|
4 |
|
5 | function validateArgs (args) {
|
6 | if (args.length === 0) {
|
7 | cli.exit(1, 'Usage: heroku ci:config:set KEY1 [KEY2 ...]\nMust specify KEY to unset.')
|
8 | }
|
9 | }
|
10 |
|
11 | function* run (context, heroku) {
|
12 | validateArgs(context.args)
|
13 |
|
14 | const vars = context.args.reduce((memo, key) => {
|
15 | memo[key] = null
|
16 | return memo
|
17 | }, {})
|
18 |
|
19 | const coupling = yield api.pipelineCoupling(heroku, context.app)
|
20 |
|
21 | yield cli.action(
|
22 | `Unsetting ${Object.keys(vars).join(', ')}`,
|
23 | api.setConfigVars(heroku, coupling.pipeline.id, vars)
|
24 | )
|
25 | }
|
26 |
|
27 | module.exports = {
|
28 | topic: 'ci',
|
29 | command: 'config:unset',
|
30 | needsApp: true,
|
31 | needsAuth: true,
|
32 | variableArgs: true,
|
33 | description: 'unset CI config vars',
|
34 | help: `Examples:
|
35 | $ heroku ci:config:uset RAILS_ENV
|
36 | Unsetting RAILS_ENV... done
|
37 | `,
|
38 | run: cli.command(co.wrap(run))
|
39 | }
|