* docs: prepare Vendoo 1.41.2 git-ignore boundary hotfix * fix: track native source modules with root-anchored runtime ignores
26 lines
1008 B
JavaScript
26 lines
1008 B
JavaScript
import { readFileSync } from 'node:fs';
|
|
import { dirname, join } from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
import { PlatformError } from '../../kernel/errors.mjs';
|
|
|
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
const manifest = JSON.parse(readFileSync(join(here, 'module.json'), 'utf8'));
|
|
let service = null;
|
|
let adapters = { etsyApi: null, ebayApi: null };
|
|
|
|
export function configureSettingsModule(nextAdapters = {}) { adapters = { ...adapters, ...nextAdapters }; }
|
|
export function getSettingsService() {
|
|
if (!service) throw new PlatformError('Einstellungs-Modul ist noch nicht gestartet.', { code: 'SETTINGS_MODULE_NOT_READY', status: 503, expose: true });
|
|
return service;
|
|
}
|
|
export function createSettingsModule() {
|
|
return {
|
|
manifest,
|
|
lifecycle: {
|
|
async start() { service = (await import('./service.mjs')).createSettingsService(adapters); },
|
|
async stop() { service = null; },
|
|
async health() { return getSettingsService().health(); },
|
|
},
|
|
};
|
|
}
|