Reading conf file

This commit is contained in:
vdv committed 2023-03-03 10:18:21 +01:00
1 parent 8731b6f8a5
commit 5d9f494a41
3 files changed
+11 -2

No files matched your search

+3 -1
View File
@@ -1,6 +1,8 @@
import { APIEvent, json } from 'solid-start/api';
import { readConfig } from '~/server-only-lib/read-config';
export async function GET({ params, env }: APIEvent) {
console.log({ caller: 'api/conf GET', params });
const {credentials} = readConfig();
console.log({ caller: 'api/conf GET', params, credentials });
return json({ params, env, response: 'OK' });
}
+7
View File
@@ -0,0 +1,7 @@
import { readFileSync } from 'node:fs';
export const readConfig = () => {
const filePath = 'conf/config.json';
const fileContent = readFileSync(filePath, { encoding: 'utf-8' });
return JSON.parse(fileContent);
};