Add Hytale config editor and Prometheus integration
All checks were successful
Deploy GSM / deploy (push) Successful in 25s
All checks were successful
Deploy GSM / deploy (push) Successful in 25s
- Add Node Exporter target for Hytale server (10.0.30.204:9100) - Add Hytale config read/write functions to ssh.js - Add GET/PUT /hytale/config API routes - Create HytaleConfigEditor.jsx with JSON syntax highlighting - Add Hytale config tab to ServerDetail.jsx - Add stopCmd and port to Hytale server config Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -642,3 +642,30 @@ export async function writeOpenTTDConfig(server, content) {
|
||||
await ssh.execCommand(`ls -t /opt/openttd/.openttd/openttd.cfg.backup.* 2>/dev/null | tail -n +6 | xargs rm -f 2>/dev/null || true`);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Hytale Config Management
|
||||
const HYTALE_CONFIG_PATH = "/opt/hytale/Server/config.json";
|
||||
|
||||
export async function readHytaleConfig(server) {
|
||||
const ssh = await getConnection(server.host, server.sshUser);
|
||||
const result = await ssh.execCommand(`cat ${HYTALE_CONFIG_PATH}`);
|
||||
if (result.code !== 0) {
|
||||
throw new Error(result.stderr || "Failed to read config file");
|
||||
}
|
||||
return result.stdout;
|
||||
}
|
||||
|
||||
export async function writeHytaleConfig(server, content) {
|
||||
const ssh = await getConnection(server.host, server.sshUser);
|
||||
const backupName = `config.json.backup.${Date.now()}`;
|
||||
await ssh.execCommand(`cp ${HYTALE_CONFIG_PATH} /opt/hytale/Server/${backupName} 2>/dev/null || true`);
|
||||
const sftp = await ssh.requestSFTP();
|
||||
await new Promise((resolve, reject) => {
|
||||
sftp.writeFile(HYTALE_CONFIG_PATH, content, (err) => {
|
||||
if (err) reject(err);
|
||||
else resolve();
|
||||
});
|
||||
});
|
||||
await ssh.execCommand(`ls -t /opt/hytale/Server/config.json.backup.* 2>/dev/null | tail -n +6 | xargs rm -f 2>/dev/null || true`);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user