How to use the @heroku-cli/plugin-pg-v5.host function in @heroku-cli/plugin-pg-v5

To help you get started, we’ve selected a few @heroku-cli/plugin-pg-v5 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github heroku / heroku-pg-extras / commands / user_connections.js View on Github external
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) {
github heroku / heroku-pg-extras / commands / stats_reset.js View on Github external
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)
}

@heroku-cli/plugin-pg-v5

Heroku CLI plugin to manage Postgres.

ISC
Latest version published 8 months ago

Package Health Score

74 / 100
Full package analysis