heroku-certs
Advanced tools
Comparing version 1.1.27 to 1.1.28
@@ -297,3 +297,3 @@ 'use strict' | ||
if (meta.type !== 'SNI' || cert.cname) { | ||
if (meta.flag !== 'sni' || cert.cname) { | ||
cli.log(`${cli.color.app(context.app)} now served by ${cli.color.green(cert.cname)}`) | ||
@@ -300,0 +300,0 @@ } |
@@ -14,3 +14,3 @@ 'use strict' | ||
let endpoint = yield flags(context, heroku) | ||
if (endpoint._meta.type === 'SNI') { | ||
if (endpoint._meta.flag === 'sni') { | ||
error.exit(1, 'SNI Endpoints cannot be rolled back, please update with a new cert.') | ||
@@ -17,0 +17,0 @@ } |
@@ -7,2 +7,17 @@ 'use strict' | ||
function type (f) { | ||
if (f.cname && f.cname.endsWith('.herokuspace.com')) { | ||
return 'Private Space App' | ||
} | ||
switch (f._meta.flag) { | ||
case 'sni': | ||
return 'SNI' | ||
case 'ssl': | ||
return 'Endpoint' | ||
} | ||
throw new Error(`Unexpected flag ${f._meta.flag}`) | ||
} | ||
module.exports = function (certs, domains) { | ||
@@ -15,3 +30,3 @@ let mapped = certs.filter(function (f) { return f.ssl_cert }).map(function (f) { | ||
ca_signed: f.ssl_cert['ca_signed?'], | ||
type: f._meta.type, | ||
type: type(f), | ||
common_names: f.ssl_cert.cert_domains.join(', ') | ||
@@ -18,0 +33,0 @@ } |
@@ -27,13 +27,11 @@ 'use strict' | ||
function meta (app, t, name) { | ||
var path, type, variant | ||
var path, variant | ||
if (t === 'sni') { | ||
type = 'SNI' | ||
path = `/apps/${app}/sni-endpoints` | ||
variant = 'sni_ssl_cert' | ||
} else if (t === 'ssl') { | ||
type = 'Endpoint' | ||
path = `/apps/${app}/ssl-endpoints` | ||
variant = 'ssl_cert' | ||
} else { | ||
throw Error('Unknown type ' + type) | ||
throw Error('Unknown type ' + t) | ||
} | ||
@@ -43,3 +41,3 @@ if (name) { | ||
} | ||
return {path, type, variant} | ||
return {path, variant, flag: t} | ||
} | ||
@@ -46,0 +44,0 @@ |
{ | ||
"name": "heroku-certs", | ||
"description": "heroku ssl plugin", | ||
"version": "1.1.27", | ||
"version": "1.1.28", | ||
"author": "Ransom Briggs rbriggs@heroku.com", | ||
@@ -6,0 +6,0 @@ "bugs": { |
@@ -14,2 +14,4 @@ 'use strict' | ||
let endpointSpace = require('../../stubs/ssl-endpoints.js').endpoint_space | ||
describe('heroku certs', function () { | ||
@@ -106,2 +108,35 @@ beforeEach(function () { | ||
it('# shows Private Space App for the type when in private space', function () { | ||
let mockSni = nock('https://api.heroku.com') | ||
.get('/apps/example/sni-endpoints') | ||
.reply(422, { | ||
'id': 'space_app_not_supported', | ||
'message': 'App heroku-certs-test is in a space, but space apps are not supported on this endpoint. Try `/apps/:id/ssl-endpoints` instead.' | ||
}) | ||
let mockSsl = nock('https://api.heroku.com', { | ||
reqheaders: {'Accept': 'application/vnd.heroku+json; version=3.ssl_cert'} | ||
}) | ||
.get('/apps/example/ssl-endpoints') | ||
.reply(200, [endpointSpace]) | ||
let mockDomains = nock('https://api.heroku.com') | ||
.get('/apps/example/domains') | ||
.reply(200, []) | ||
return certs.run({app: 'example'}).then(function () { | ||
mockSni.done() | ||
mockSsl.done() | ||
mockDomains.done() | ||
expect(cli.stderr).to.equal('') | ||
/* eslint-disable no-trailing-spaces */ | ||
expect(cli.stdout).to.equal( | ||
`Name Endpoint Common Name(s) Expires Trusted Type | ||
────────── ───────────────────────────────────── ────────────── ──────────────────── ─────── ───────────────── | ||
tokyo-1050 tokyo-1050.japan-4321.herokuspace.com heroku.com 2013-08-01 21:34 UTC True Private Space App | ||
`) | ||
/* eslint-enable no-trailing-spaces */ | ||
}) | ||
}) | ||
it('# shows certs with common names stacked and stable matches', function () { | ||
@@ -108,0 +143,0 @@ let mockSni = nock('https://api.heroku.com', { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
228198
47
3513