feat: Implement config system

This commit is contained in:
2026-07-06 08:02:54 +05:30
parent 496b17faf0
commit 535ed1142f
6 changed files with 164 additions and 3 deletions

View File

@@ -0,0 +1,8 @@
import { z } from "zod";
import path from "node:path";
const CoreConfigSchema = z.object({
OMNIA_DB_PATH: z.string().default(path.join(process.cwd(), "omnia.db")),
});
export const coreConfig = CoreConfigSchema.parse(process.env);

View File

@@ -1,3 +1,7 @@
import { config } from "dotenv";
import path from "node:path";
config({ path: path.resolve(__dirname, "../.env") });
export * from "./attribute.js";
export * from "./entity.js";
export * from "./world.js";

View File

@@ -5,5 +5,8 @@
"type": "module",
"exports": {
".": "./dist/index.js"
},
"dependencies": {
"@types/node": "^26.1.0"
}
}

View File

@@ -0,0 +1,7 @@
import { z } from "zod";
const LLMConfigSchema = z.object({
GOOGLE_API_KEY: z.string().min(1, "GOOGLE_API_KEY is required"),
});
export const llmConfig = LLMConfigSchema.parse(process.env);

View File

@@ -2,7 +2,8 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist"
"outDir": "dist",
"types": ["node"]
},
"include": ["src"],
"references": []