more aws graceful

This commit is contained in:
Jocelyn Badgley (Twipped) 2021-08-25 09:22:39 -07:00
parent 3301db8d0e
commit 3e570577b2

View File

@ -1,9 +1,20 @@
const log = require('fancy-log');
const aws = require('aws-sdk');
var credentials = require('../aws.json');
var Promise = require('bluebird');
var credentials;
try {
credentials = require('../aws.json');
} catch (e) {
credentials = null;
}
async function invalidate (wait) {
if (!credentials) {
console.error('Cannot access cloudfront without AWS credentials present.'); // eslint-disable-line
return false;
}
var cloudfront = new aws.CloudFront();
cloudfront.config.update({ credentials });