Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function * run (context, heroku) {
let feature
try {
feature = yield heroku.get(`/account/features/${context.args.feature}`)
} catch (err) {
if (err.statusCode !== 404) throw err
// might be an app feature
if (!context.app) throw err
feature = yield heroku.get(`/apps/${context.app}/features/${context.args.feature}`)
}
if (context.flags.json) {
cli.styledJSON(feature)
} else {
print(feature)
}
}
function* run (context, heroku) {
let configVars = yield heroku.request({path: `/apps/${context.app}/config-vars`});
let v = configVars[context.args.key];
if (v === undefined) {
cli.log(''); // match v3 output for missing
} else {
if (context.flags.shell) {
v = process.stdout.isTTY ? shellescape([v]) : v;
cli.log(`${context.args.key}=${v}`);
} else {
cli.log(v);
}
}
}
function * run () {
const Heroku = require('heroku-client')
if (process.env.HEROKU_API_KEY) {
cli.warn('HEROKU_API_KEY is set. Not using netrc credentials.')
}
let token = cli.auth.token()
if (!token) cli.exit(1, 'not logged in')
let heroku = new Heroku({token})
let account = yield heroku.get('/account')
cli.log(account.email)
}
function* patchConfig(context, heroku, payload, success) {
try {
yield heroku.patch(`/apps/${context.app}/config-vars`, { body: payload })
if (!context.flags.quiet) {
cli.log(success)
}
} catch (err) {
cli.exit(1, err)
}
}
function display (spaces) {
cli.table(spaces, {
columns: [
{ key: 'name', label: 'Name' },
{ key: 'team.name', label: 'Team' },
{ key: 'region.name', label: 'Region' },
{ key: 'state', label: 'State' },
{ key: 'created_at', label: 'Created At' }
]
})
}
function display (spaces) {
cli.table(spaces, {
columns: [
{ key: 'name', label: 'Name' },
{ key: 'team.name', label: 'Team' },
{ key: 'region.name', label: 'Region' },
{ key: 'state', label: 'State' },
{ key: 'created_at', label: 'Created At' }
]
})
}
function * run (context, heroku) {
let connections = yield api.withUserConnections(context, context.app, context.flags, heroku, true, api.ADDON_TYPE_EVENTS)
if (context.flags.json) {
cli.styledJSON(connections)
} else {
cli.table(connections, {
columns: [
{key: 'db_key', label: 'Kafka'},
{key: 'schema_name', label: 'Schema'},
{key: 'state', label: 'State'}
]
})
}
}
function * run (context, heroku) {
let connections = yield api.withUserConnections(context, context.app, context.flags, heroku)
if (context.flags.json) {
cli.styledJSON(connections)
} else {
cli.table(connections, {
columns: [
{key: 'db_key', label: 'Database'},
{key: 'schema_name', label: 'Schema'},
{key: 'state', label: 'State'}
]
})
}
}
module.exports = function(topic) {
return {
topic: topic,
command: 'login',
flags: [{ name: 'verbose', char: 'v', hasValue: false }],
description: 'Logs in to the Heroku Docker registry',
needsApp: false,
needsAuth: true,
run: cli.command(co.wrap(login))
};
};
module.exports = function(topic) {
return {
topic: topic,
command: 'push',
description: 'Builds, then pushes a Docker image to deploy your Heroku app',
needsApp: true,
needsAuth: true,
args: [{ name: 'process', optional: true }],
run: cli.command(co.wrap(push))
};
};