feat(blog): add bindProductionBlog(config) DI helper for app boot
This commit is contained in:
13
packages/blog/src/di/bind-production.ts
Normal file
13
packages/blog/src/di/bind-production.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import type { SanitizedConfig } from "payload";
|
||||
import { blogContainer } from "./container";
|
||||
import { BLOG_SYMBOLS } from "./symbols";
|
||||
import { PayloadArticlesRepository } from "../infrastructure/repositories/payload-articles.repository";
|
||||
|
||||
export function bindProductionBlog(config: SanitizedConfig): void {
|
||||
if (blogContainer.isBound(BLOG_SYMBOLS.IArticlesRepository)) {
|
||||
blogContainer.unbind(BLOG_SYMBOLS.IArticlesRepository);
|
||||
}
|
||||
blogContainer
|
||||
.bind(BLOG_SYMBOLS.IArticlesRepository)
|
||||
.toConstantValue(new PayloadArticlesRepository(config));
|
||||
}
|
||||
Reference in New Issue
Block a user