2026-06-01 20:49:07 +02:00
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace ITNexusAgent.Models;
|
|
|
|
|
|
|
|
|
|
public class AgentConfig
|
|
|
|
|
{
|
|
|
|
|
[JsonProperty("server_url")]
|
|
|
|
|
public string ServerUrl { get; set; } = "";
|
|
|
|
|
|
|
|
|
|
[JsonProperty("agent_key")]
|
|
|
|
|
public string AgentKey { get; set; } = "";
|
|
|
|
|
|
|
|
|
|
public static AgentConfig Load(string path)
|
|
|
|
|
{
|
|
|
|
|
var json = File.ReadAllText(path);
|
|
|
|
|
return JsonConvert.DeserializeObject<AgentConfig>(json)
|
|
|
|
|
?? throw new Exception("Ungültige config.json");
|
|
|
|
|
}
|
2026-06-26 13:50:02 +02:00
|
|
|
|
|
|
|
|
public void Save(string path)
|
|
|
|
|
{
|
|
|
|
|
File.WriteAllText(path, JsonConvert.SerializeObject(this, Formatting.Indented));
|
|
|
|
|
}
|
2026-06-01 20:49:07 +02:00
|
|
|
}
|