Files
IT-Nexus/agent-cs/Models/Config.cs

21 lines
493 B
C#

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");
}
}