chore: cleanup/improve bootstrap (#14023)
* chore: cleanup/improve bootstrap * chore: cleanup/improve bootstrap * Create few-guests-visit.md
This commit is contained in:
1 parent
213c344804
commit
7e3eb6e413
6 files changed
+59
-45
No files matched your search
@@ -200,6 +200,8 @@ async function start(args: {
|
||||
skipDbConnection: true,
|
||||
})
|
||||
const logger = container.resolve(ContainerRegistrationKeys.LOGGER)
|
||||
const serverActivity = logger.activity(`Creating server`)
|
||||
|
||||
await registerInstrumentation(directory)
|
||||
|
||||
const app = express()
|
||||
@@ -259,8 +261,6 @@ async function start(args: {
|
||||
}
|
||||
}
|
||||
|
||||
const serverActivity = logger.activity(`Creating server`)
|
||||
|
||||
// Register a health check endpoint. Ideally this also checks the readiness of the service, rather than just returning a static response.
|
||||
app.get("/health", (_, res) => {
|
||||
res.status(200).send("OK")
|
||||
|
||||
@@ -92,8 +92,10 @@ async function loadEntrypoints(
|
||||
)
|
||||
|
||||
if (shouldLoadBackgroundProcessors(configModule)) {
|
||||
await subscribersLoader(plugins, container)
|
||||
await jobsLoader(plugins, container)
|
||||
await promiseAll([
|
||||
subscribersLoader(plugins, container),
|
||||
jobsLoader(plugins, container),
|
||||
])
|
||||
}
|
||||
|
||||
if (isWorkerMode(configModule)) {
|
||||
@@ -119,17 +121,18 @@ async function loadEntrypoints(
|
||||
next()
|
||||
})
|
||||
|
||||
const { shutdown } = await expressLoader({
|
||||
app: expressApp,
|
||||
container,
|
||||
})
|
||||
|
||||
await adminLoader({ app: expressApp, configModule, rootDirectory, plugins })
|
||||
await apiLoader({
|
||||
container,
|
||||
plugins,
|
||||
app: expressApp,
|
||||
})
|
||||
const [{ shutdown }] = await promiseAll([
|
||||
expressLoader({
|
||||
app: expressApp,
|
||||
container,
|
||||
}),
|
||||
adminLoader({ app: expressApp, configModule, rootDirectory, plugins }),
|
||||
apiLoader({
|
||||
container,
|
||||
plugins,
|
||||
app: expressApp,
|
||||
}),
|
||||
])
|
||||
|
||||
return shutdown
|
||||
}
|
||||
@@ -140,10 +143,8 @@ export async function initializeContainer(
|
||||
skipDbConnection?: boolean
|
||||
}
|
||||
): Promise<MedusaContainer> {
|
||||
// custom flags from medusa project
|
||||
await featureFlagsLoader(rootDirectory)
|
||||
const configDir = await configLoader(rootDirectory, "medusa-config")
|
||||
// core flags
|
||||
await featureFlagsLoader(join(__dirname, ".."))
|
||||
|
||||
const customLogger = configDir.logger ?? defaultLogger
|
||||
|
||||
Reference in new issue
Block a user