Add Node.js manager service and updated docker-compose

This commit is contained in:
2026-05-10 20:43:48 -03:00
parent de6543acf5
commit 119bb443d9
11 changed files with 237 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
import fs from "fs";
import path from "path";
import YAML from "yaml";
export interface InstanceConfig {
id: string;
containerName: string;
image: string;
savedDir: string;
configPaths: {
serverDescription: string;
worldsRoot: string;
};
}
const CONFIG_PATH = path.join(__dirname, "..", "..", "config", "instances.yml");
let cache: { instances: InstanceConfig[] };
export function loadConfig() {
if (!cache) {
const raw = fs.readFileSync(CONFIG_PATH, "utf8");
cache = YAML.parse(raw);
}
return cache;
}
export function getInstance(id: string) {
return loadConfig().instances.find(i => i.id === id);
}