heroku-certs
Advanced tools
Comparing version 1.1.18 to 1.1.19
@@ -75,2 +75,6 @@ 'use strict' | ||
function hasMatch (certDomains, domain) { | ||
return _.find(certDomains, (certDomain) => (certDomain === domain || isWildcardMatch(certDomain, domain))) | ||
} | ||
function getFlagChoices (context, certDomains, existingDomains) { | ||
@@ -80,3 +84,3 @@ let flagDomains = context.flags.domains.split(',').map((str) => str.trim()).filter((str) => str !== '') | ||
let badChoices = _.remove(choices, (choice) => (!_.find(certDomains, (certDomain) => certDomain === choice))) | ||
let badChoices = _.remove(choices, (choice) => (!hasMatch(certDomains, choice))) | ||
badChoices.forEach(function (choice) { | ||
@@ -243,7 +247,3 @@ cli.warn(`Not adding ${choice} because it is not listed in the certificate`) | ||
if (hasWildcard && domain.hostname) { | ||
let hasMatch = _.some(certDomains, function (certDomain) { | ||
return domain.hostname === certDomain || isWildcardMatch(certDomain, domain.hostname) | ||
}) | ||
if (!hasMatch) { | ||
if (!hasMatch(certDomains, domain.hostname)) { | ||
warning = '! Does not match any domains on your SSL certificate' | ||
@@ -250,0 +250,0 @@ } |
{ | ||
"name": "heroku-certs", | ||
"version": "1.1.18", | ||
"version": "1.1.19", | ||
"description": "heroku ssl plugin", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -572,2 +572,43 @@ 'use strict' | ||
it('# when passed existing domains does not prompt and creates an SNI endpoint with stable cnames if no SSL addon and wildcard match', function () { | ||
let mock = nock('https://api.heroku.com') | ||
.post('/apps/example/sni-endpoints', { | ||
certificate_chain: 'pem content', private_key: 'key content' | ||
}) | ||
.reply(200, endpointWildcard) | ||
let domainsMock = nock('https://api.heroku.com') | ||
.get('/apps/example/domains') | ||
.reply(200, []) | ||
let domainsCreateFoo = nock('https://api.heroku.com') | ||
.post('/apps/example/domains', {hostname: 'foo.example.org'}) | ||
.reply(200, | ||
{'kind': 'custom', 'cname': 'foo.example.org.herokudns.com', 'hostname': 'foo.example.org'} | ||
) | ||
return certs.run({app: 'example', args: {CRT: 'pem_file', KEY: 'key_file'}, flags: {bypass: true, domains: 'foo.example.org'}}).then(function () { | ||
mock.done() | ||
domainsMock.done() | ||
domainsCreateFoo.done() | ||
expect(unwrap(cli.stderr)).to.equal('Adding SSL certificate to example... done\n\nAdding domain foo.example.org to example... done\n') | ||
/* eslint-disable no-trailing-spaces */ | ||
expect(cli.stdout).to.equal( | ||
`Certificate details: | ||
Common Name(s): *.example.org | ||
Expires At: 2013-08-01 21:34 UTC | ||
Issuer: /C=US/ST=California/L=San Francisco/O=Heroku by Salesforce/CN=secure.example.org | ||
Starts At: 2012-08-01 21:34 UTC | ||
Subject: /C=US/ST=California/L=San Francisco/O=Heroku by Salesforce/CN=secure.example.org | ||
SSL certificate is self signed. | ||
=== Your certificate has been added successfully. Update your application's DNS settings as follows | ||
Domain Record Type DNS Target | ||
─────────────── ─────────── ───────────────────────────── | ||
foo.example.org CNAME foo.example.org.herokudns.com | ||
`) | ||
/* eslint-enable no-trailing-spaces */ | ||
}) | ||
}) | ||
it('# when passed bad domains does not prompt and creates an SNI endpoint with stable cnames if no SSL addon', function () { | ||
@@ -574,0 +615,0 @@ let mock = 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
144155
3385