You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
967 B
TypeScript
35 lines
967 B
TypeScript
import DiContainer, {
|
|
LoadDict,
|
|
mergeLDs,
|
|
} from 'di-why';
|
|
import expressLoadDict, { EXPRESS_MIDDLEWARE, buildMiddlewareConfig } from 'express-knifey';
|
|
import type { MiddlewarePathConfig } from 'express-knifey';
|
|
import { swissoidAuthLoadDict, SWISSOID_MIDDLEWARE } from 'swissoid-back';
|
|
|
|
const middlewareConfig: MiddlewarePathConfig = buildMiddlewareConfig([
|
|
{
|
|
path: '*',
|
|
middleware: [
|
|
EXPRESS_MIDDLEWARE.trustProxy,
|
|
EXPRESS_MIDDLEWARE.cors,
|
|
EXPRESS_MIDDLEWARE.cookieParser,
|
|
EXPRESS_MIDDLEWARE.bodyParser,
|
|
SWISSOID_MIDDLEWARE.oidcStandardRoutes,
|
|
],
|
|
},
|
|
{
|
|
path: EXPRESS_MIDDLEWARE.healthCheck.defaultPath ?? '/healthz',
|
|
middleware: [EXPRESS_MIDDLEWARE.healthCheck],
|
|
},
|
|
]);
|
|
|
|
export const loadDict: LoadDict = mergeLDs(
|
|
expressLoadDict,
|
|
swissoidAuthLoadDict,
|
|
{ middlewareConfig: { instance: middlewareConfig } },
|
|
);
|
|
|
|
const diContainer = new DiContainer({ load: loadDict });
|
|
|
|
export default diContainer;
|