Beispiel #1
0
        private static NginxConfigurationModel Parse(string text)
        {
            var model = new NginxConfigurationModel {
                IsActive = false
            };

            model = NginxParser.ParseOptions(model, text);
            model = NginxParser.ParseEventsOptions(model, text);
            var upstreams = NginxParser.ParseUpstream(text);

            model.Upstreams = upstreams;
            var http = NginxParser.ParseHttpProtocol(text);

            model.Http = http;
            var servers = NginxParser.ParseServer(text);

            model.Servers = servers;
            return(model);
        }
Beispiel #2
0
        public static void Parse()
        {
            if (!File.Exists(MainFilePath))
            {
                return;
            }
            var content = File.ReadAllText(MainFilePath);
            var model   = new NginxModel {
                Active = false
            };

            model = NginxParser.ParseOptions(model, content);
            model = NginxParser.ParseEventsOptions(model, content);
            var upstreams = NginxParser.ParseUpstream(content);

            model.Upstreams = upstreams;
            var http = NginxParser.ParseHttpProtocol(content);

            model.Http = http;
            var servers = NginxParser.ParseServer(content);

            model.Servers = servers;
            ConsoleLogger.Log("[dhcpd] import existing configuration");
        }