Ghost/ghost/adapter-manager
Naz 0f86a05ed4
Added ":" syntax to adapter manager
refs https://github.com/TryGhost/Toolbox/issues/384

- The syntax using a colon ":" separator has been successfully used to enable multiple adapters. The adapter manager can benefit from same convention to enable more elastic adapter cache - have multiple instances of adapters from same base class
2022-09-06 17:51:57 +08:00
..
lib Added ":" syntax to adapter manager 2022-09-06 17:51:57 +08:00
test Added ":" syntax to adapter manager 2022-09-06 17:51:57 +08:00
.eslintrc.js Remove trailing commas from .eslintrc.js files 2020-08-04 14:48:07 +01:00
index.js Added @tryghost/adapter-manager module (#38) 2020-04-05 15:54:47 +02:00
package.json Fixed full Admin test suite running during unit tests 2022-08-15 15:34:52 +02:00
README.md Tidied up package README and LICENSE files 2022-07-26 15:22:10 +02:00

Adapter Manager

A manager for retrieving custom "adapters" - can be used to abstract away from custom implementations

Usage

const AdapterManager = require('@tryghost/adapter-manager');

const adapterManager = new AdapterManager({
    pathsToAdapters: [
        '/path/to/custom/adapters',
        '/path/to/default/adapters'
    ]
});

class MailAdapterBase {
    someMethod() {}
}

adapterManager.register('mail', MailAdapterBase);

const mailAdapterInstance = adapterManager.getAdapter('mail', 'direct', mailConfig);

mailAdapterInstance.someMethod();