Ejemplo n.º 1
0
        /// <summary>
        /// Generates NGINX configuration sections for all given resource proxies. Additionally the extended URI templates are applied to the configuration.
        /// </summary>
        /// <param name="resourceProxies">List of resources to generate the NGINX proxy configuration from.</param>
        /// <returns>NGINX configuration sections for all given resources and their extended URI templates matches.</returns>
        private IList <NginxConfigSection> GenerateConfigSections(IList <ResourceProxyDTO> resourceProxies)
        {
            IList <NginxConfigSection> nginxConfigSections = new List <NginxConfigSection>();

            var extendedUris = _extendedUriTemplateService.GetEntities(null);

            foreach (var resourceProxy in resourceProxies)
            {
                try
                {
                    ConvertToNginxConfigSectionsAndAppendTemplates(resourceProxy, extendedUris, nginxConfigSections);
                }
                catch (System.Exception exception)
                {
                    _logger.LogError(exception, Messages.Proxy.ResourceProxy, resourceProxy);
                }
            }

            nginxConfigSections = FilterDuplicateConfigurationSections(nginxConfigSections);
            nginxConfigSections = OrderConfigurationSections(nginxConfigSections);

            return(nginxConfigSections);
        }
        public IActionResult GetExtendedUriTemplates()
        {
            var extendedUriTemplates = _extendedUriTemplateService.GetEntities(null);

            return(Ok(extendedUriTemplates));
        }