Use our own hapi-postgraphile plugin

1. Much much less code
2. The third-party plugin only supported JWT which we no longer use
This commit is contained in:
Abel Luck 2023-06-07 10:28:03 +00:00
parent ffee8f42e4
commit 9b2f08ab7e
4 changed files with 69 additions and 36 deletions

View file

@ -2,9 +2,6 @@ import * as Glue from "@hapi/glue";
import * as Metamigo from "@digiresilience/metamigo-common";
import * as Blipp from "blipp";
import HapiBasic from "@hapi/basic";
//import HapiJwt from "hapi-auth-jwt2";
//import HapiPostgraphile from "hapi-postgraphile";
import { getPostGraphileOptions } from "@digiresilience/metamigo-db";
import AppPlugin from "../app/index.js";
import type { IAppConfig } from "../config.js";
@ -24,9 +21,6 @@ const build = async (config: IAppConfig): Promise<Glue.Manifest> => {
},
register: {
plugins: [
// jwt plugin, required for our jwt auth plugin
//{ plugin: HapiJwt },
// Blipp prints the nicely formatted list of endpoints at app boot
{ plugin: Blipp },
@ -43,33 +37,6 @@ const build = async (config: IAppConfig): Promise<Glue.Manifest> => {
config,
},
},
// load Postgraphile
/*
{
plugin: HapiPostgraphile,
options: {
route: {
path: "/graphql",
options: {
auth: {
strategies: ["session-id-bearer-token"],
mode: "optional",
},
},
},
pgConfig: config.postgraphile.authConnection,
schemaName: "app_public",
schemaOptions: {
...getPostGraphileOptions(),
jwtAudiences: [config.nextAuth.audience],
jwtSecret: "",
// unauthenticated users will hit the database with this role
pgDefaultRole: "app_anonymous",
},
},
},
*/
],
},
};