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

Open
by Ghost opened 3 years ago · 0 comments
Ghost commented 3 years ago

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

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.