1. Much much less code 2. The third-party plugin only supported JWT which we no longer use
49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
import * as Glue from "@hapi/glue";
|
|
import * as Metamigo from "@digiresilience/metamigo-common";
|
|
import * as Blipp from "blipp";
|
|
import HapiBasic from "@hapi/basic";
|
|
import AppPlugin from "../app/index.js";
|
|
import type { IAppConfig } from "../config.js";
|
|
|
|
const build = async (config: IAppConfig): Promise<Glue.Manifest> => {
|
|
const { port, address } = config.server;
|
|
const metamigoPlugins = Metamigo.defaultPlugins(config);
|
|
return {
|
|
server: {
|
|
port,
|
|
address,
|
|
debug: false, // We use pino not the built-in hapi logger
|
|
routes: {
|
|
validate: {
|
|
failAction: Metamigo.validatingFailAction,
|
|
},
|
|
},
|
|
},
|
|
register: {
|
|
plugins: [
|
|
// Blipp prints the nicely formatted list of endpoints at app boot
|
|
{ plugin: Blipp },
|
|
|
|
// load the metamigo base plugins
|
|
...metamigoPlugins,
|
|
|
|
// basic authentication, required by hapi-nextauth
|
|
{ plugin: HapiBasic },
|
|
|
|
// load our main app
|
|
{
|
|
plugin: AppPlugin,
|
|
options: {
|
|
config,
|
|
},
|
|
},
|
|
],
|
|
},
|
|
};
|
|
};
|
|
|
|
const Manifest = {
|
|
build,
|
|
};
|
|
|
|
export default Manifest;
|