fix: use raius pi id for persistence
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user