0f86a05ed4
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 |
||
---|---|---|
.. | ||
lib | ||
test | ||
.eslintrc.js | ||
index.js | ||
package.json | ||
README.md |
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();