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) {
const app = context.app
const {database} = context.args
let db = yield pg.fetcher(heroku).addon(app, database)
yield util.ensureNonStarterPlan(db)
let host = pg.host(db)
let credentials = yield heroku.get(`/postgres/v0/databases/${db.name}/credentials`, { host: host })
let defaultCredentials = _.filter(credentials, c => c.name === 'default')
let defaultUsers = _.flatMap(defaultCredentials, c => _.map(c.credentials, u => u.user))
let isDefaultUser = (user) => _.includes(defaultUsers, user)
let styledName = (user) => {
if (isDefaultUser(user)) {
return 'default'
} else {
return user
}
}
let rsp = yield heroku.get(`/client/v11/databases/${db.name}/user_connections`, {host})
let connections = _.map(rsp.connections, function (v, k) {
function * run (context, heroku) {
const app = context.app
const {database} = context.args
let db = yield pg.fetcher(heroku).addon(app, database)
yield util.ensureNonStarterPlan(db)
let host = pg.host(db)
let rsp = yield heroku.put(`/client/v11/databases/${db.name}/stats_reset`, {host})
cli.log(rsp.message)
}