feat(web-next): add server bindAllProduction() aggregator with idempotent guard
This commit is contained in:
18
apps/web-next/src/server/bind-production.ts
Normal file
18
apps/web-next/src/server/bind-production.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
// SERVER-ONLY: this module imports Payload config and must never be bundled into the browser.
|
||||||
|
import config from "@repo/core-cms";
|
||||||
|
import { bindProductionBlog } from "@repo/blog/di/bind-production";
|
||||||
|
import { bindProductionAuth } from "@repo/auth/di/bind-production";
|
||||||
|
import { bindProductionMarketingPages } from "@repo/marketing-pages/di/bind-production";
|
||||||
|
import { bindProductionNavigation } from "@repo/navigation/di/bind-production";
|
||||||
|
|
||||||
|
let bound = false;
|
||||||
|
|
||||||
|
export async function bindAllProduction(): Promise<void> {
|
||||||
|
if (bound) return;
|
||||||
|
bound = true;
|
||||||
|
const resolvedConfig = await config;
|
||||||
|
bindProductionAuth(resolvedConfig);
|
||||||
|
bindProductionBlog(resolvedConfig);
|
||||||
|
bindProductionMarketingPages(resolvedConfig);
|
||||||
|
bindProductionNavigation(resolvedConfig);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user