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

Відкрито
відкрито 2021-01-13 21:13:07 +00:00 користувачем Ghost · 0 коментарів
Ghost прокоментував(ла) 2021-01-13 21:13:07 +00:00

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 :( ```
Підпишіться щоб приєднатися до обговорення.
Без мітки
Етап відсутній
Немає виконавця
1 учасників
Сповіщення
Дата завершення
Термін дії не дійсний або знаходиться за межами допустимого діапазону. Будь ласка використовуйте формат 'yyyy-mm-dd'.

Термін виконання не встановлений.

Залежності

No dependencies set.

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