Files
plainleaf/client/syscalls/config.ts
T
Zef HemelandGitHub a524c64884 Go backend (#1555)
* Replaces old Deno server with a Go implementation
* Restructured the code base accordingly
2025-09-19 13:23:20 +02:00

30 lines
801 B
TypeScript

import type { SysCallMapping } from "../../lib/plugos/system.ts";
import type { Config } from "../config.ts";
export function configSyscalls(config: Config): SysCallMapping {
return {
"config.get": (_ctx, path: string, defaultValue: any) => {
return config.get(path, defaultValue);
},
"config.set": (
_ctx,
keyOrValues: string | string[] | Record<string, any>,
value?: any,
) => {
config.set(keyOrValues as any, value);
},
"config.has": (_ctx, path: string) => {
return config.has(path);
},
"config.define": (_ctx, key: string, schema: any) => {
config.define(key, schema);
},
"config.getValues": () => {
return config.values;
},
"config.getSchemas": () => {
return config.schemas;
},
};
}