2019-10-20 08:51:19 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
require('dotenv').config();
|
|
|
|
|
|
|
|
var path = require('path');
|
|
|
|
var Greenlock = require('../');
|
|
|
|
|
|
|
|
var subject = process.env.BASE_DOMAIN;
|
|
|
|
var altnames = [subject, '*.' + subject, 'foo.bar.' + subject];
|
|
|
|
var email = process.env.SUBSCRIBER_EMAIL;
|
|
|
|
var challenge = JSON.parse(process.env.CHALLENGE_OPTIONS);
|
2019-10-20 09:17:19 +00:00
|
|
|
challenge.module = process.env.CHALLENGE_PLUGIN;
|
2019-10-20 08:51:19 +00:00
|
|
|
|
|
|
|
var greenlock = Greenlock.create({
|
|
|
|
agreeTos: true,
|
|
|
|
maintainerEmail: email,
|
|
|
|
staging: true,
|
|
|
|
manager: path.join(__dirname, 'manager.js'),
|
|
|
|
challenges: {
|
|
|
|
'dns-01': challenge
|
|
|
|
}
|
|
|
|
//configFile: '~/.config/greenlock/certs.json',
|
|
|
|
//challenges: challenges,
|
|
|
|
//store: args.storeOpts,
|
|
|
|
//renewOffset: args.renewOffset || '30d',
|
|
|
|
//renewStagger: '1d'
|
|
|
|
});
|
|
|
|
|
|
|
|
greenlock
|
|
|
|
.add({
|
|
|
|
subject: subject,
|
|
|
|
altnames: altnames,
|
|
|
|
subscriberEmail: email
|
|
|
|
})
|
|
|
|
.then(function() {
|
2019-10-20 09:17:19 +00:00
|
|
|
return greenlock.renew().then(function (pems) {
|
|
|
|
console.info(pems);
|
|
|
|
});
|
2019-10-20 08:51:19 +00:00
|
|
|
})
|
|
|
|
.catch(function(e) {
|
|
|
|
console.error('yo', e.code);
|
|
|
|
console.error(e);
|
|
|
|
});
|