Skip to content

Instantly share code, notes, and snippets.

@raine
Created March 10, 2015 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raine/2b6f5c4ef03582bb0de1 to your computer and use it in GitHub Desktop.
Save raine/2b6f5c4ef03582bb0de1 to your computer and use it in GitHub Desktop.
var R = require('ramda');
var debug = require('debug')('check-img-https');
var readBuildImageURLs = require('./lib/read-build-image-urls');
var URL = require('url');
var SHOULD_BE_HTTPS = [
'example.com',
];
var any = R.any(R.I);
var isHTTP = R.propEq('protocol', 'http:');
var hostShouldBeHTTPS = R.compose( any, R.ap(R.map(R.propEq('hostname'), SHOULD_BE_HTTPS)), R.of );
var isBadURL = R.compose( R.and(isHTTP, hostShouldBeHTTPS), URL.parse );
var checkURL = function(url) {
if (isBadURL(url)) throw new Error('Not HTTPS: ' + url);
};
readBuildImageURLs()
.then(R.forEach(checkURL))
.catch(function(e) {
console.error(e);
process.exit(1);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment