Default manager has no find function - need it (or something) to get list of domains being handled #38

Open
opened 2021-01-13 21:13:07 +00:00 by Ghost · 0 comments

Sorry if I've missed this, but just can't find it in the doco.

I have GL working just fine issuing certs. Works great - thx! :)

But... would like to implement this in a configurable server where domain names can be added or removed. For this need to find a list of configured domains (subjects) and for those that have been removed from the server configuration by the user need to also remove from GL handling.

Looking in greenlock-manager-fs (which appears to be the default) there is a find function but this mysteriously disappears and is not available by referencing the object returned from create.

Example code:

   const glOpts = {
        packageRoot: __dirname,
        configDir: settings.dir,
        maintainerEmail: settings.email,
        cluster: false,
        packageAgent: pkg.name + '/' + pkg.version,
        notify: (ev, params) => {
        	// snip
        }
    };

    if (settings.staging) {
        glOpts.staging = true;
    }

    const gl = require('greenlock').create(glOpts);

    // Add sites.
    for (const domain of settings.domains) {
        gl.add({ subject: domain, altnames: [domain] });
    }

    const domains = await gl.find();
    // Also tried: const domains = await gl.manager.find();
    
    // At this point I would expect domains to hold list sites to process but
    // the above fails as somehow the find function does not exist :(
    
Sorry if I've missed this, but just can't find it in the doco. I have GL working just fine issuing certs. Works great - thx! :) But... would like to implement this in a configurable server where domain names can be added or removed. For this need to `find` a list of configured domains (subjects) and for those that have been removed from the server configuration by the user need to also remove from GL handling. Looking in `greenlock-manager-fs` (which appears to be the default) there is a `find` function but this mysteriously disappears and is not available by referencing the object returned from `create`. Example code: ```JS const glOpts = { packageRoot: __dirname, configDir: settings.dir, maintainerEmail: settings.email, cluster: false, packageAgent: pkg.name + '/' + pkg.version, notify: (ev, params) => { // snip } }; if (settings.staging) { glOpts.staging = true; } const gl = require('greenlock').create(glOpts); // Add sites. for (const domain of settings.domains) { gl.add({ subject: domain, altnames: [domain] }); } const domains = await gl.find(); // Also tried: const domains = await gl.manager.find(); // At this point I would expect domains to hold list sites to process but // the above fails as somehow the find function does not exist :( ```
Sign in to join this conversation.
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: root/greenlock.js#38
No description provided.