*Add app getter method to api

This commit is contained in:
Derrick Hammer 2023-04-18 22:47:09 -04:00
parent 356681af35
commit 3ac8e38f66
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 9 additions and 0 deletions

View File

@ -19,3 +19,7 @@ export async function start() {
await app.listen({ port: config.uint("core.appport"), host: "0.0.0.0" });
}
export function get(): FastifyInstance {
return app;
}

View File

@ -17,6 +17,7 @@ import {
ProtocolManager,
} from "./swarm.js";
import { get as getSSl, SSLManager } from "./ssl.js";
import { get as getApp } from "./app.js";
import type { HDKey } from "micro-ed25519-hdkey";
import corePlugins from "../plugins";
import Util from "./plugin/util";
@ -95,6 +96,10 @@ class PluginAPI extends EventEmitter2 {
return getProtocolManager();
}
get app() {
return getApp();
}
public loadPlugin(
moduleName: string
): (moduleName: string) => Promise<Plugin> {