chore(framework): Move feature flags related resources and cleanup (#8297)
**What** cleanup and move the feature flag related resources to manage them. It also include some refactoring around loading and registering the flag as well as not relying on the `glob` package anymore plus some reorganization of the code itself FIXES FRMW-2625
This commit is contained in:
1 parent
8a5751c115
commit
9b6de8c02d
21 files changed
+364
-174
No files matched your search
@@ -4,7 +4,7 @@ export async function configLoaderOverride(
|
||||
entryDirectory: string,
|
||||
override: { clientUrl: string; debug?: boolean }
|
||||
) {
|
||||
const { configManager } = await import("@medusajs/framework/config")
|
||||
const { configManager } = await import("@medusajs/framework")
|
||||
const { configModule, error } = getConfigFile<
|
||||
ReturnType<typeof configManager.loadConfig>
|
||||
>(entryDirectory, "medusa-config.js")
|
||||
|
||||
@@ -6,21 +6,21 @@ export async function initDb({ env = {} }: { env?: Record<any, any> }) {
|
||||
Object.entries(env).forEach(([k, v]) => (process.env[k] = v))
|
||||
}
|
||||
|
||||
const { configManager, pgConnectionLoader, container } = await import(
|
||||
"@medusajs/framework"
|
||||
)
|
||||
const {
|
||||
configManager,
|
||||
pgConnectionLoader,
|
||||
logger,
|
||||
container,
|
||||
featureFlagsLoader,
|
||||
} = await import("@medusajs/framework")
|
||||
|
||||
const configModule = configManager.config
|
||||
|
||||
const pgConnection = pgConnectionLoader()
|
||||
|
||||
const featureFlagRouter =
|
||||
require("@medusajs/medusa/dist/loaders/feature-flags").default(configModule)
|
||||
await featureFlagsLoader()
|
||||
|
||||
container.register({
|
||||
[ContainerRegistrationKeys.CONFIG_MODULE]: asValue(configModule),
|
||||
[ContainerRegistrationKeys.LOGGER]: asValue(console),
|
||||
[ContainerRegistrationKeys.PG_CONNECTION]: asValue(pgConnection),
|
||||
[ContainerRegistrationKeys.FEATURE_FLAG_ROUTER]: asValue(featureFlagRouter),
|
||||
[ContainerRegistrationKeys.LOGGER]: asValue(logger),
|
||||
})
|
||||
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user