mirror of
https://github.com/outline/outline.git
synced 2025-12-21 10:39:41 -06:00
PluginManager refactor (#6677)
* fix: refactor plugin manager * fix: make id optional * fix: allow add to accept single object * fix: getHooks * fix: tsc * fix: remove id
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"id": "email",
|
||||
"name": "Email",
|
||||
"priority": 200,
|
||||
"description": "Adds an email magic link authentication provider."
|
||||
}
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
import env from "@server/env";
|
||||
import { PluginManager, PluginType } from "@server/utils/PluginManager";
|
||||
import { Hook, PluginManager } from "@server/utils/PluginManager";
|
||||
import config from "../plugin.json";
|
||||
import router from "./auth/email";
|
||||
|
||||
PluginManager.register(PluginType.AuthProvider, router, {
|
||||
...config,
|
||||
enabled: (!!env.SMTP_HOST && !!env.SMTP_USERNAME) || env.isDevelopment,
|
||||
});
|
||||
const enabled = (!!env.SMTP_HOST && !!env.SMTP_USERNAME) || env.isDevelopment;
|
||||
|
||||
if (enabled) {
|
||||
PluginManager.add({
|
||||
...config,
|
||||
type: Hook.AuthProvider,
|
||||
value: { router, id: config.id },
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user