project setup with core files including configuration, package management, and basic structure. Added .gitignore, README, and various TypeScript types for CMS components. Implemented initial components and layouts for the application.
This commit is contained in:
23
middlelayer/adapters/config.ts
Normal file
23
middlelayer/adapters/config.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { MockdataAdapter } from "./Mock/mockdata";
|
||||
import type { DataAdapter } from "./interface";
|
||||
|
||||
/**
|
||||
* Adapter-Konfiguration
|
||||
* Bestimmt welcher Adapter basierend auf Environment-Variablen verwendet wird
|
||||
*/
|
||||
export function createAdapter(): DataAdapter {
|
||||
const adapterType = process.env.DATA_ADAPTER || "mock";
|
||||
|
||||
switch (adapterType) {
|
||||
case "mock":
|
||||
return new MockdataAdapter();
|
||||
// Weitere Adapter können hier hinzugefügt werden:
|
||||
// case 'contentful':
|
||||
// return new ContentfulAdapter(process.env.CONTENTFUL_SPACE_ID!, process.env.CONTENTFUL_ACCESS_TOKEN!);
|
||||
default:
|
||||
console.warn(
|
||||
`Unbekannter Adapter-Typ: ${adapterType}. Verwende Mock-Adapter.`
|
||||
);
|
||||
return new MockdataAdapter();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user