heroku-certs
Advanced tools
Comparing version 1.1.30 to 1.1.31
@@ -7,3 +7,2 @@ 'use strict' | ||
let inquirer = require('inquirer') | ||
let psl = require('psl') | ||
@@ -19,2 +18,4 @@ let error = require('../../lib/error.js') | ||
let {waitForDomains, printDomains} = require('../../lib/domains') | ||
function Domains (domains) { | ||
@@ -102,41 +103,6 @@ this.domains = domains | ||
function * getDomains (context, heroku) { | ||
function someNull (domains) { | ||
return _.some(domains, (domain) => domain.kind === 'custom' && !domain.cname) | ||
} | ||
function apiRequest (context, heroku) { | ||
return heroku.request({ | ||
path: `/apps/${context.app}/domains` | ||
}) | ||
} | ||
let apiDomains = yield apiRequest(context, heroku) | ||
if (someNull(apiDomains)) { | ||
yield cli.action('Waiting for stable domains to be created', co(function * () { | ||
const wait = require('co-wait') | ||
let i = 0 | ||
do { | ||
// trying 30 times was easier for me to test that setTimeout | ||
if (i >= 30) { | ||
throw new Error('Timed out while waiting for stable domains to be created') | ||
} | ||
yield wait(1000) | ||
apiDomains = yield apiRequest(context, heroku) | ||
i++ | ||
} while (someNull(apiDomains)) | ||
})) | ||
} | ||
return apiDomains | ||
} | ||
function * addDomains (context, heroku, meta, cert) { | ||
let certDomains = cert.ssl_cert.cert_domains | ||
let apiDomains = yield getDomains(context, heroku) | ||
let apiDomains = yield waitForDomains(context, heroku) | ||
@@ -217,6 +183,2 @@ let existingDomains = [] | ||
let type = function (domain) { | ||
return psl.parse(domain.hostname).subdomain === null ? 'ALIAS/ANAME' : 'CNAME' | ||
} | ||
let hasWildcard = _.some(certDomains, (certDomain) => isWildcard(certDomain)) | ||
@@ -234,25 +196,7 @@ | ||
return Object.assign({}, domain, {type: type(domain), warning: warning}) | ||
return Object.assign({}, domain, {warning: warning}) | ||
}) | ||
if (domainsTable.length === 0) { | ||
/* eslint-disable no-irregular-whitespace */ | ||
cli.styledHeader(`Your certificate has been added successfully. Add a custom domain to your app by running ${cli.color.app('heroku domains:add <yourdomain.com>')}`) | ||
/* eslint-enable no-irregular-whitespace */ | ||
} else { | ||
cli.styledHeader("Your certificate has been added successfully. Update your application's DNS settings as follows") | ||
printDomains(domainsTable, 'Your certificate has been added successfully.') | ||
let columns = [ | ||
{label: 'Domain', key: 'hostname'}, | ||
{label: 'Record Type', key: 'type'}, | ||
{label: 'DNS Target', key: 'cname'} | ||
] | ||
if (_.some(domainsTable, (domain) => domain.warning)) { | ||
columns.push({label: 'Warnings', key: 'warning'}) | ||
} | ||
cli.table(domainsTable, {columns: columns}) | ||
} | ||
if (domains.hasFailed) { | ||
@@ -259,0 +203,0 @@ error.exit(2) |
@@ -22,2 +22,9 @@ 'use strict' | ||
let auto = [ | ||
require('./commands/certs/auto.js'), | ||
require('./commands/certs/auto/enable.js'), | ||
require('./commands/certs/auto/disable.js'), | ||
require('./commands/certs/auto/refresh.js') | ||
] | ||
function deprecate (cmd) { | ||
@@ -34,2 +41,2 @@ let deprecatedRun = function (context) { | ||
exports.commands = commands.concat(commands.map((cmd) => deprecate(cmd))) | ||
exports.commands = commands.concat(commands.map((cmd) => deprecate(cmd))).concat(auto) |
@@ -12,2 +12,6 @@ 'use strict' | ||
if (f.ssl_cert && f.ssl_cert.acm) { | ||
return 'ACM' | ||
} | ||
switch (f._meta.flag) { | ||
@@ -14,0 +18,0 @@ case 'sni': |
{ | ||
"name": "heroku-certs", | ||
"description": "heroku ssl plugin", | ||
"version": "1.1.30", | ||
"version": "1.1.31", | ||
"author": "Ransom Briggs rbriggs@heroku.com", | ||
@@ -6,0 +6,0 @@ "bugs": { |
@@ -87,3 +87,3 @@ 'use strict' | ||
=== Your certificate has been added successfully. Add a custom domain to your app by running heroku domains:add <yourdomain.com> | ||
=== Your certificate has been added successfully. Add a custom domain to your app by running heroku domains:add <yourdomain.com> | ||
`) | ||
@@ -142,3 +142,3 @@ /* eslint-enable no-irregular-whitespace */ | ||
=== Your certificate has been added successfully. Add a custom domain to your app by running heroku domains:add <yourdomain.com> | ||
=== Your certificate has been added successfully. Add a custom domain to your app by running heroku domains:add <yourdomain.com> | ||
`) | ||
@@ -193,3 +193,3 @@ }) | ||
=== Your certificate has been added successfully. Add a custom domain to your app by running heroku domains:add <yourdomain.com> | ||
=== Your certificate has been added successfully. Add a custom domain to your app by running heroku domains:add <yourdomain.com> | ||
`) | ||
@@ -291,3 +291,3 @@ }) | ||
=== Your certificate has been added successfully. Add a custom domain to your app by running heroku domains:add <yourdomain.com> | ||
=== Your certificate has been added successfully. Add a custom domain to your app by running heroku domains:add <yourdomain.com> | ||
`) | ||
@@ -379,3 +379,3 @@ /* eslint-enable no-irregular-whitespace */ | ||
=== Your certificate has been added successfully. Add a custom domain to your app by running heroku domains:add <yourdomain.com> | ||
=== Your certificate has been added successfully. Add a custom domain to your app by running heroku domains:add <yourdomain.com> | ||
`) | ||
@@ -420,3 +420,3 @@ }) | ||
=== Your certificate has been added successfully. Add a custom domain to your app by running heroku domains:add <yourdomain.com> | ||
=== Your certificate has been added successfully. Add a custom domain to your app by running heroku domains:add <yourdomain.com> | ||
`) | ||
@@ -825,3 +825,3 @@ }) | ||
=== Your certificate has been added successfully. Add a custom domain to your app by running heroku domains:add <yourdomain.com> | ||
=== Your certificate has been added successfully. Add a custom domain to your app by running heroku domains:add <yourdomain.com> | ||
`) | ||
@@ -906,3 +906,3 @@ /* eslint-enable no-trailing-spaces */ | ||
=== Your certificate has been added successfully. Add a custom domain to your app by running heroku domains:add <yourdomain.com> | ||
=== Your certificate has been added successfully. Add a custom domain to your app by running heroku domains:add <yourdomain.com> | ||
`) | ||
@@ -1020,3 +1020,3 @@ /* eslint-enable no-irregular-whitespace */ | ||
=== Your certificate has been added successfully. Add a custom domain to your app by running heroku domains:add <yourdomain.com> | ||
=== Your certificate has been added successfully. Add a custom domain to your app by running heroku domains:add <yourdomain.com> | ||
`) | ||
@@ -1197,3 +1197,3 @@ /* eslint-disable no-irregular-whitespace */ | ||
=== Your certificate has been added successfully. Add a custom domain to your app by running heroku domains:add <yourdomain.com> | ||
=== Your certificate has been added successfully. Add a custom domain to your app by running heroku domains:add <yourdomain.com> | ||
`) | ||
@@ -1229,3 +1229,3 @@ }) | ||
=== Your certificate has been added successfully. Add a custom domain to your app by running heroku domains:add <yourdomain.com> | ||
=== Your certificate has been added successfully. Add a custom domain to your app by running heroku domains:add <yourdomain.com> | ||
`) | ||
@@ -1232,0 +1232,0 @@ }) |
@@ -13,2 +13,3 @@ 'use strict' | ||
let endpointWildcardBug = require('../../stubs/sni-endpoints.js').endpoint_wildcard_bug | ||
let endpointAcm = require('../../stubs/sni-endpoints.js').endpoint_acm | ||
@@ -141,2 +142,34 @@ let endpointSpace = require('../../stubs/ssl-endpoints.js').endpoint_space | ||
it('# shows ACM for the type when acm true', function () { | ||
let mockSni = nock('https://api.heroku.com', { | ||
reqheaders: {'Accept': 'application/vnd.heroku+json; version=3.sni_ssl_cert'} | ||
}) | ||
.get('/apps/example/sni-endpoints') | ||
.reply(200, [endpointAcm]) | ||
let mockSsl = nock('https://api.heroku.com', { | ||
reqheaders: {'Accept': 'application/vnd.heroku+json; version=3.ssl_cert'} | ||
}) | ||
.get('/apps/example/ssl-endpoints') | ||
.reply(200, []) | ||
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 Common Name(s) Expires Trusted Type | ||
────────── ────────────── ──────────────────── ─────── ──── | ||
tokyo-1050 heroku.com 2013-08-01 21:34 UTC True ACM | ||
`) | ||
/* eslint-enable no-trailing-spaces */ | ||
}) | ||
}) | ||
it('# shows certs with common names stacked and stable matches', function () { | ||
@@ -143,0 +176,0 @@ let mockSni = nock('https://api.heroku.com', { |
@@ -133,3 +133,15 @@ 'use strict' | ||
} | ||
}, | ||
endpoint_acm: { 'name': 'tokyo-1050', | ||
'cname': null, | ||
'ssl_cert': { | ||
'ca_signed?': true, | ||
'cert_domains': [ 'heroku.com' ], | ||
'starts_at': '2012-08-01T21:34:23Z', | ||
'expires_at': '2013-08-01T21:34:23Z', | ||
'issuer': '/C=US/ST=California/L=San Francisco/O=Heroku by Salesforce/CN=example-1.example.org', | ||
'subject': '/C=US/ST=California/L=San Francisco/O=Heroku by Salesforce/CN=example-1.example.org', | ||
'acm': true | ||
} | ||
} | ||
} |
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
263833
57
4306