greenlock.js icon indicating copy to clipboard operation
greenlock.js copied to clipboard

Using greenlock without express module

Open mirsahib opened this issue 2 years ago • 0 comments

I am trying to use the only the greenlock module with my server so that I have more customization capability The code is given below

const app = require('./app.ts');
const path = require('path');
const pkg = require('../package.json');
const rootdir = path.join(__dirname, '../');
console.log(rootdir);
const Greenlock = require('greenlock');
const greenlock = Greenlock.create({
    packageRoot: rootdir,
    configDir: './greenlock.d/',
    packageAgent: pkg.name + '/' + pkg.version,
    maintainerEmail: '[email protected]',
    staging: false,
    notify: function (event: any, details: any) {
        if ('error' === event) {
            // `details` is an error object in this case
            console.error('details', details);
        }
    },
});


greenlock.manager
    .defaults({
        agreeToTerms: true,
        subscriberEmail: '[email protected]'
    })
    .then(function(fullConfig:any) {
        console.log('fullconfig',fullConfig)
    });


const altnames = ['con.getbonton.com'];

greenlock
    .add({
        subject: altnames[0],
        altnames: altnames,
    })
    .then(function (data: any) {
        // saved config to db (or file system)
        console.log('config', data);
    });
app.listen(80)
app.listen(443)

I am getting dry challenge failed error when I try to run the above code

mirsahib avatar Apr 26 '22 05:04 mirsahib