public IActionResult Rules(WebServerRules model)
        {
            if (model != null)
            {
                SystemController.webServerRules = model;

                dynamic json = ReadConfig();
                json.WebServer.Rules = JObject.FromObject(model);
                WriteConfig(json);
                configuration.Reload();
            }

            return RedirectToAction("Index");
        }
 public static void ReadConfig()
 {
     try
     {
         gatewayConfig = configuration.Get<GatewayConfig>("Gateway");
         gatewayConfig.SerialGatewayConfig = configuration.Get<SerialGatewayConfig>("Gateway:SerialGateway");
         gatewayConfig.EthernetGatewayConfig = configuration.Get<EthernetGatewayConfig>("Gateway:EthernetGateway");
         logs.config = configuration.Get<LogsConfig>("Logs");
         logs.consoleConfig = configuration.Get<ConsoleConfig>("Console");
         nodesEngineConfig = configuration.Get<NodesEngineConfig>("NodesEngine");
         nodeEditorConfig = configuration.Get<NodeEditorConfig>("NodeEditor");
         dataBaseConfig = configuration.Get<DataBaseConfig>("DataBase");
         webServerRules = configuration.Get<WebServerRules>("WebServer");
         webServerConfig = configuration.Get<WebServerConfig>("WebServer");
     }
     catch
     {
         logs.AddSystemError("ERROR: Bad configuration in appsettings.json file.");
         throw new Exception("Bad configuration in appsettings.json file.");
     }
 }