chore(framework): Continue to move loaders to framework (#8258)
**What** More move and cleanup FIXES FRMW-2603 FIXES FRMW-2608 FIXES FRMW-2610 FIXES FRMW-2611 Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
co-authored by
Oli Juhl
parent
a2a377c8ca
commit
bcd9d9c2b1
@@ -4,8 +4,6 @@ export async function configLoaderOverride(
|
||||
entryDirectory: string,
|
||||
override: { clientUrl: string; debug?: boolean }
|
||||
) {
|
||||
// in case it is not install as it is optional and required only when using this util
|
||||
// @ts-ignore
|
||||
const { configManager } = await import("@medusajs/framework/config")
|
||||
const { configModule, error } = getConfigFile<
|
||||
ReturnType<typeof configManager.loadConfig>
|
||||
@@ -27,5 +25,8 @@ export async function configLoaderOverride(
|
||||
idle_in_transaction_session_timeout: 20000,
|
||||
}
|
||||
|
||||
configManager.loadConfig(configModule)
|
||||
configManager.loadConfig({
|
||||
projectConfig: configModule,
|
||||
baseDir: entryDirectory,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
import {
|
||||
ContainerRegistrationKeys,
|
||||
createMedusaContainer,
|
||||
isObject,
|
||||
} from "@medusajs/utils"
|
||||
import { ContainerRegistrationKeys, isObject } from "@medusajs/utils"
|
||||
import { asValue } from "awilix"
|
||||
|
||||
export async function initDb({ env = {} }: { env?: Record<any, any> }) {
|
||||
@@ -10,18 +6,12 @@ export async function initDb({ env = {} }: { env?: Record<any, any> }) {
|
||||
Object.entries(env).forEach(([k, v]) => (process.env[k] = v))
|
||||
}
|
||||
|
||||
const container = createMedusaContainer()
|
||||
|
||||
// in case it is not install as it is optional and required only when using this util
|
||||
// @ts-ignore
|
||||
const { configManager } = await import("@medusajs/framework/config")
|
||||
const { configManager, pgConnectionLoader, container } = await import(
|
||||
"@medusajs/framework"
|
||||
)
|
||||
const configModule = configManager.config
|
||||
|
||||
const pgConnection =
|
||||
await require("@medusajs/medusa/dist/loaders/pg-connection").default({
|
||||
configModule,
|
||||
container,
|
||||
})
|
||||
const pgConnection = pgConnectionLoader()
|
||||
|
||||
const featureFlagRouter =
|
||||
require("@medusajs/medusa/dist/loaders/feature-flags").default(configModule)
|
||||
|
||||
Reference in New Issue
Block a user