1 | 'use strict'
|
2 |
|
3 | let co = require('co')
|
4 | let cli = require('heroku-cli-util')
|
5 |
|
6 | let flags = require('../../lib/flags.js')
|
7 | let certificateDetails = require('../../lib/certificate_details.js')
|
8 |
|
9 | function * run (context, heroku) {
|
10 | let endpoint = yield flags(context, heroku)
|
11 |
|
12 | let cert = yield cli.action(`Fetching SSL certificate ${endpoint.name} info for ${cli.color.app(context.app)}`, {}, heroku.request({
|
13 | path: endpoint._meta.path,
|
14 | headers: {'Accept': `application/vnd.heroku+json; version=3.${endpoint._meta.variant}`}
|
15 | }))
|
16 |
|
17 | certificateDetails(cert)
|
18 | }
|
19 |
|
20 | module.exports = {
|
21 | topic: 'certs',
|
22 | command: 'info',
|
23 | flags: [
|
24 | {name: 'name', hasValue: true, description: 'name to check info on'},
|
25 | {name: 'endpoint', hasValue: true, description: 'endpoint to check info on'}
|
26 | ],
|
27 | description: 'show certificate information for an SSL certificate',
|
28 | needsApp: true,
|
29 | needsAuth: true,
|
30 | run: cli.command(co.wrap(run))
|
31 | }
|