automatic service registration à la Svelte

This commit is contained in:
2023-08-11 18:49:06 +02:00
parent 9903497867
commit f23f268b60
11 changed files with 95 additions and 49 deletions

View File

@@ -3,7 +3,7 @@ import { config, stripPrivateFields, type Config, type ServiceConfig } from '$li
import type { PageServerLoad } from './$types';
import * as yml from 'js-yaml';
import { readFile } from 'fs/promises';
import { getService } from '$lib/services/service';
import { getService } from '$lib/services/services';
async function reloadConfig(): Promise<Config> {
if (dev) {
@@ -34,6 +34,7 @@ export const load: PageServerLoad = async ({ fetch, depends }) => {
const clientService = clientGroup.items[service] as ServiceConfig;
const [handler, type] = getService(serverService.type || '');
clientService.type = type;
Object.assign(clientService, handler({ fetch, config: serverService }));
}