-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix issue where app was loading twice when in dev/dual mode
- Loading branch information
1 parent
7376a61
commit 745afe9
Showing
7 changed files
with
58 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// src/shared.ts | ||
import { connectToDatabase } from './config/database'; | ||
import { initEnforcer } from './rbac'; | ||
import { bootstrap } from './plugins/auth-plugin/bootstrap'; | ||
import PluginLoader from './plugins/plugin-loader'; | ||
import logger from './config/logger'; | ||
|
||
const loggerCtx = { context: 'shared' }; | ||
|
||
export async function initializeSharedResources() { | ||
await connectToDatabase(); | ||
await initEnforcer(); // Initialize Casbin | ||
await bootstrap(); // Bootstrap the application with a superuser | ||
|
||
const pluginLoader = new PluginLoader(); | ||
pluginLoader.loadPlugins(); | ||
|
||
// Register models before initializing plugins | ||
pluginLoader.registerModels(); | ||
|
||
// Initialize plugins (extend models and resolvers) | ||
pluginLoader.initializePlugins(); | ||
|
||
return pluginLoader; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters