static EnvoyDefaults()
        {
            var connectTimeout = Environment.GetEnvironmentVariable("HttpRequestConnectTimeoutMs");

            if (connectTimeout != null)
            {
                try
                {
                    connect_timeout_ms = Convert.ToInt32(connectTimeout);
                }
                catch { }
            }

            var requestTimeout = Environment.GetEnvironmentVariable("DefaultHttpRequestTimeoutMs");

            if (requestTimeout != null)
            {
                try
                {
                    timeout_ms = Convert.ToInt32(requestTimeout);
                }
                catch { }
            }

            var removeResponseHeaders = Environment.GetEnvironmentVariable("RemoveServiceResponseHeaders");

            if (removeResponseHeaders != null)
            {
                try
                {
                    response_headers_to_remove.AddRange(removeResponseHeaders.Replace(" ", "").Split(','));
                }
                catch { }
            }

            var useHttps = Environment.GetEnvironmentVariable("UseHttps");

            if (useHttps != null && useHttps == "true")
            {
                var verify_certificate_hash = Environment.GetEnvironmentVariable("ServiceCertificateHash");

                var subjectAlternateName = Environment.GetEnvironmentVariable("ServiceCertificateAlternateNames");
                if (subjectAlternateName != null)
                {
                    try
                    {
                        verify_subject_alt_name.AddRange(subjectAlternateName.Replace(" ", "").Split(','));
                    }
                    catch { }
                }
                cluster_ssl_context = new cluster_ssl_context(verify_certificate_hash, verify_subject_alt_name);
            }

            host_ip = Environment.GetEnvironmentVariable("Fabric_NodeIPOrFQDN");
            if (host_ip == null || host_ip == "localhost")
            {
                bool runningInContainer = Environment.GetEnvironmentVariable("__STANDALONE_TESTING__") == null;
                if (runningInContainer)
                {
                    // running in a container outside of Service Fabric or
                    // running in a container on local dev cluster
                    host_ip = GetInternalGatewayAddress();
                }
                else if (Environment.GetEnvironmentVariable("__USE_LOCALHOST__") == null)
                {
                    // running outside of Service Fabric or
                    // running on local dev cluster
                    host_ip = GetIpAddress();
                }
                else
                {
                    host_ip = "127.0.0.1";
                }
            }
            var port = Environment.GetEnvironmentVariable("ManagementPort");

            if (port != null)
            {
                management_port = port;
            }

            client_cert_subject_name = Environment.GetEnvironmentVariable("SF_ClientCertCommonName");
            var issuer_thumbprints = Environment.GetEnvironmentVariable("SF_ClientCertIssuerThumbprints");

            if (issuer_thumbprints != null)
            {
                client_cert_issuer_thumbprints = issuer_thumbprints.Split(',');
            }
            var server_common_names = Environment.GetEnvironmentVariable("SF_ClusterCertCommonNames");

            if (server_common_names != null)
            {
                server_cert_common_names = server_common_names.Split(',');
            }
            var server_issuer_thumbprints = Environment.GetEnvironmentVariable("SF_ClusterCertIssuerThumbprints");

            if (server_issuer_thumbprints != null)
            {
                server_cert_issuer_thumbprints = server_issuer_thumbprints.Split(',');
            }

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                fabricUri = new String[] { host_ip + ":" + management_port };
            }
            else
            {
                fabricUri = null;
            }

            LogMessage(String.Format("Management Endpoint={0}:{1}", host_ip, management_port));
            if (fabricUri != null)
            {
                LogMessage(String.Format("Fabric Uri ={0}", fabricUri));
            }
            else
            {
                LogMessage(String.Format("Fabric Uri =[]"));
            }

            if (client_cert_subject_name != null)
            {
                LogMessage(String.Format("SF_ClientCertCommonName={0}", client_cert_subject_name));
            }
            if (issuer_thumbprints != null)
            {
                LogMessage(String.Format("SF_ClientCertIssuerThumbprints={0}", issuer_thumbprints));
            }
            if (server_cert_common_names != null)
            {
                LogMessage(String.Format("SF_ClusterCertCommonNames={0}", server_cert_common_names));
            }
            if (server_issuer_thumbprints != null)
            {
                LogMessage(String.Format("SF_ClusterCertIssuerThumbprints={0}", server_issuer_thumbprints));
            }

            gateway_listen_ip = Environment.GetEnvironmentVariable("Gateway_Listen_IP");
            if (gateway_listen_ip == null)
            {
                gateway_listen_ip = "0.0.0.0";
            }
            //Gateway_Config_L4=ApplicationName=App, ServiceName=srv, EndpointName=ep1, PublicPort=8081, ApplicationName=App, ServiceName=srv, EndpointName=ep2, PublicPort=8082

            string gateway_config_L4 = Environment.GetEnvironmentVariable("Gateway_Config_L4");

            if (gateway_config_L4 != null)
            {
                gateway_map = new Dictionary <string, string>();
                var segments = gateway_config_L4.Split(",");
                for (int i = 0; i < segments.Count(); i += 4)
                {
                    var applicationSegements = segments[i].Split("=");
                    var serviceSegements     = segments[i + 1].Split("=");
                    var endpointSegements    = segments[i + 2].Split("=");
                    var publicPortSegements  = segments[i + 3].Split("=");

                    string serviceName = applicationSegements[1] + "_" + serviceSegements[1];
                    if (endpointSegements[1] != "")
                    {
                        serviceName += "_" + endpointSegements[1];
                    }
                    serviceName += "|*|-2";
                    gateway_map[serviceName] = publicPortSegements[1];
                }
            }
        }
        static EnvoyDefaults()
        {
            var connectTimeout = Environment.GetEnvironmentVariable("HttpRequestConnectTimeoutMs");

            if (connectTimeout != null)
            {
                try
                {
                    connect_timeout_ms = Convert.ToInt32(connectTimeout);
                }
                catch { }
            }

            var requestTimeout = Environment.GetEnvironmentVariable("DefaultHttpRequestTimeoutMs");

            if (requestTimeout != null)
            {
                try
                {
                    timeout_ms = Convert.ToInt32(requestTimeout);
                }
                catch { }
            }

            var removeResponseHeaders = Environment.GetEnvironmentVariable("RemoveServiceResponseHeaders");

            if (removeResponseHeaders != null)
            {
                try
                {
                    response_headers_to_remove.AddRange(removeResponseHeaders.Replace(" ", "").Split(','));
                }
                catch { }
            }

            var useHttps = Environment.GetEnvironmentVariable("UseHttps");

            if (useHttps != null && useHttps == "true")
            {
                var verify_certificate_hash = Environment.GetEnvironmentVariable("ServiceCertificateHash");

                var subjectAlternateName = Environment.GetEnvironmentVariable("ServiceCertificateAlternateNames");
                if (subjectAlternateName != null)
                {
                    try
                    {
                        verify_subject_alt_name.AddRange(subjectAlternateName.Replace(" ", "").Split(','));
                    }
                    catch { }
                }
                cluster_ssl_context = new cluster_ssl_context(verify_certificate_hash, verify_subject_alt_name);
            }

            host_ip = Environment.GetEnvironmentVariable("Fabric_NodeIPOrFQDN");
            if (host_ip == null || host_ip == "localhost")
            {
                bool runningInContainer = Environment.GetEnvironmentVariable("__STANDALONE_TESTING__") == null;
                if (runningInContainer)
                {
                    // running in a container outside of Service Fabric or
                    // running in a container on local dev cluster
                    host_ip = GetInternalGatewayAddress();
                }
                else if (Environment.GetEnvironmentVariable("__USE_LOCALHOST__") == null)
                {
                    // running outside of Service Fabric or
                    // running on local dev cluster
                    host_ip = GetIpAddress();
                }
                else
                {
                    host_ip = "127.0.0.1";
                }
            }
            var port = Environment.GetEnvironmentVariable("ManagementPort");

            if (port != null)
            {
                management_port = port;
            }

            client_cert_subject_name = Environment.GetEnvironmentVariable("SF_ClientCertCommonName");
            var issuer_thumbprints = Environment.GetEnvironmentVariable("SF_ClientCertIssuerThumbprints");

            if (issuer_thumbprints != null)
            {
                client_cert_issuer_thumbprints = issuer_thumbprints.Split(',');
            }
            var server_common_names = Environment.GetEnvironmentVariable("SF_ClusterCertCommonNames");

            if (server_common_names != null)
            {
                server_cert_common_names = server_common_names.Split(',');
            }
            var server_issuer_thumbprints = Environment.GetEnvironmentVariable("SF_ClusterCertIssuerThumbprints");

            if (server_issuer_thumbprints != null)
            {
                server_cert_issuer_thumbprints = server_issuer_thumbprints.Split(',');
            }

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                fabricUri = new String[] { host_ip + ":" + management_port };
            }
            else
            {
                fabricUri = null;
            }

            LogMessage(String.Format("Management Endpoint={0}:{1}", host_ip, management_port));
            if (fabricUri != null)
            {
                LogMessage(String.Format("Fabric Uri ={0}", fabricUri));
            }
            else
            {
                LogMessage(String.Format("Fabric Uri =[]"));
            }

            if (client_cert_subject_name != null)
            {
                LogMessage(String.Format("SF_ClientCertCommonName={0}", client_cert_subject_name));
            }
            if (issuer_thumbprints != null)
            {
                LogMessage(String.Format("SF_ClientCertIssuerThumbprints={0}", issuer_thumbprints));
            }
            if (server_cert_common_names != null)
            {
                LogMessage(String.Format("SF_ClusterCertCommonNames={0}", server_cert_common_names));
            }
            if (server_issuer_thumbprints != null)
            {
                LogMessage(String.Format("SF_ClusterCertIssuerThumbprints={0}", server_issuer_thumbprints));
            }
        }