mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-11 23:04:52 +09:00
15 lines
491 B
TypeScript
15 lines
491 B
TypeScript
import * as fs from "fs"
|
|
import * as path from "path"
|
|
|
|
export function getSlaveDatabase(config: ClusterioConfig): Slaves {
|
|
var slaves: Slaves = {};
|
|
try{
|
|
let x = fs.statSync(path.resolve(config.databaseDirectory, "/slaves.json"));
|
|
console.log(`loading slaves from path.resolve(config.databaseDirectory, "slaves.json")`);
|
|
slaves = JSON.parse(fs.readFileSync(path.resolve(config.databaseDirectory, "slaves.json"), "utf-8"));
|
|
} catch (e){
|
|
slaves = {};
|
|
}
|
|
return slaves
|
|
}
|