2019-11-03 07:58:01 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var args = process.argv.slice(3);
|
|
|
|
var cli = require('./lib/cli.js');
|
|
|
|
//var path = require('path');
|
|
|
|
//var pkgpath = path.join(__dirname, '..', 'package.json');
|
|
|
|
//var pkgpath = path.join(process.cwd(), 'package.json');
|
|
|
|
|
|
|
|
var Flags = require('./lib/flags.js');
|
|
|
|
|
|
|
|
Flags.init({ forceSave: true }).then(function({
|
|
|
|
flagOptions,
|
|
|
|
greenlock,
|
|
|
|
mconf
|
|
|
|
}) {
|
|
|
|
var myFlags = {};
|
|
|
|
[
|
2019-11-05 10:14:18 +00:00
|
|
|
'agree-to-terms',
|
2019-11-03 07:58:01 +00:00
|
|
|
'account-key-type',
|
|
|
|
'server-key-type',
|
|
|
|
'subscriber-email',
|
|
|
|
'renew-offset',
|
|
|
|
'store',
|
|
|
|
'store-xxxx',
|
|
|
|
'challenge-http-01-xxxx',
|
|
|
|
'challenge-dns-01',
|
|
|
|
'challenge-dns-01-xxxx',
|
|
|
|
'challenge-tls-alpn-01',
|
|
|
|
'challenge-tls-alpn-01-xxxx',
|
|
|
|
'challenge',
|
|
|
|
'challenge-xxxx',
|
2019-11-05 10:14:18 +00:00
|
|
|
'challenge-http-01'
|
2019-11-03 07:58:01 +00:00
|
|
|
].forEach(function(k) {
|
|
|
|
myFlags[k] = flagOptions[k];
|
|
|
|
});
|
|
|
|
|
|
|
|
cli.parse(myFlags);
|
|
|
|
cli.main(function(argList, flags) {
|
|
|
|
Flags.mangleFlags(flags, mconf, null, { forceSave: true });
|
2019-11-19 05:55:29 +00:00
|
|
|
main(argList, flags, greenlock);
|
2019-11-03 07:58:01 +00:00
|
|
|
}, args);
|
|
|
|
});
|
|
|
|
|
2019-11-19 05:55:29 +00:00
|
|
|
async function main(_, flags, greenlock) {
|
2019-11-03 07:58:01 +00:00
|
|
|
greenlock.manager
|
|
|
|
.defaults(flags)
|
|
|
|
.catch(function(err) {
|
|
|
|
console.error();
|
|
|
|
console.error('error:', err.message);
|
|
|
|
//console.log(err.stack);
|
|
|
|
console.error();
|
|
|
|
process.exit(1);
|
|
|
|
})
|
|
|
|
.then(function() {
|
|
|
|
return greenlock.manager.defaults();
|
|
|
|
})
|
|
|
|
.then(function(dconf) {
|
|
|
|
console.info();
|
|
|
|
console.info('Global config');
|
|
|
|
console.info(JSON.stringify(dconf, null, 2));
|
|
|
|
});
|
|
|
|
}
|