UNPKG

856 BJavaScriptView Raw
1const cli = require('heroku-cli-util')
2const co = require('co')
3const shellescape = require('shell-escape')
4const api = require('../../lib/heroku-api')
5
6function* run (context, heroku) {
7 const coupling = yield api.pipelineCoupling(heroku, context.app)
8 const config = yield api.configVars(heroku, coupling.pipeline.id)
9 const value = config[context.args.key]
10
11 if (context.flags.shell) {
12 cli.log(`${context.args.key}=${shellescape([value])}`)
13 } else {
14 cli.log(value)
15 }
16}
17
18module.exports = {
19 topic: 'ci',
20 command: 'config:get',
21 needsApp: true,
22 needsAuth: true,
23 description: 'get a CI config var',
24 help: `Examples:
25$ heroku ci:config:get RAILS_ENV
26test
27`,
28 args: [{
29 name: 'key'
30 }],
31 flags: [{
32 name: 'shell',
33 char: 's',
34 description: 'output config var in shell format'
35 }],
36 run: cli.command(co.wrap(run))
37}