fix: use raius pi id for persistence

This commit is contained in:
Cristina Poncela Cubeiro
2026-06-18 15:16:03 +02:00
parent 9bfafc8c02
commit a6d88ddc3a
7 changed files with 119 additions and 45 deletions
+9 -1
View File
@@ -1,4 +1,4 @@
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import { getInstancesPath, getMachinePath, getOrchestratorDir } from "./config.ts";
import type { InstanceRecord, MachineRecord } from "./types.ts";
@@ -24,6 +24,14 @@ export function saveMachine(machine: MachineRecord): void {
writeFileSync(getMachinePath(), JSON.stringify(machine, null, 2));
}
export function deleteMachine(): void {
const machinePath = getMachinePath();
if (!existsSync(machinePath)) {
return;
}
rmSync(machinePath);
}
export function loadInstances(): InstanceRecord[] {
const instancesPath = getInstancesPath();
if (!existsSync(instancesPath)) {