Пример #1
0
        internal static HttpProcessorConfiguration LoadHttpProcessorConfiguration(IServiceEntrySink sink, string hostSuffixesConfigParamName, string enableStorageDomainNamesConfigParamName)
        {
            HttpProcessorConfiguration httpProcessorConfiguration = new HttpProcessorConfiguration()
            {
                AllowPathStyleUris         = ConfigurationHelper.GetConfigSetting <bool>(sink, "NephosAllowPathStyleUris", "Allow path-style URIs"),
                ValidHostSuffixes          = ConfigurationHelper.GetHostSuffixes(sink, hostSuffixesConfigParamName),
                MaskClientIPAddressesInLog = ConfigurationHelper.GetIPAddressMaskSetting(sink)
            };

            if (!httpProcessorConfiguration.AllowPathStyleUris)
            {
                NephosAssertionException.Assert(httpProcessorConfiguration.ValidHostSuffixes != null, "Host suffixes can't be null when AllowPathStyleUris is false. Check service model configuaration.");
                NephosAssertionException.Assert((int)httpProcessorConfiguration.ValidHostSuffixes.Length > 0, "Host suffixes can't be empty when AllowPathStyleUris is false. Check service model configuaration.");
            }
            httpProcessorConfiguration.ValidHostSuffixes = httpProcessorConfiguration.ValidHostSuffixes ?? new string[0];
            httpProcessorConfiguration.IncludeInternalDetailsInErrorResponses = ConfigurationHelper.GetConfigSetting <bool>(sink, "NephosIncludeInternalDetailsInErrorResponses", "Include internal details in error responses");
            if (!string.IsNullOrEmpty(enableStorageDomainNamesConfigParamName))
            {
                httpProcessorConfiguration.EnableStorageDomainNames = ConfigurationHelper.GetConfigSetting <bool>(sink, enableStorageDomainNamesConfigParamName, "Enable storage domain names");
            }
            try
            {
                httpProcessorConfiguration.StampName = ConfigurationHelper.GetConfigSetting <string>(sink, "StampName", "Stamp Name");
            }
            catch (Exception exception1)
            {
                Exception exception          = exception1;
                IStringDataEventStream error = Logger <IRestProtocolHeadLogger> .Instance.Error;
                object[] str = new object[] { exception.ToString() };
                error.Log("Hit Exception while reading StampName setting from ACS: {0}", str);
            }
            return(httpProcessorConfiguration);
        }
Пример #2
0
        public static HttpProcessorConfiguration LoadDefaultHttpProcessorConfiguration(IServiceEntrySink sink, string hostSuffixesConfigParamName, string enableStorageDomainNamesConfigParamName)
        {
            HttpProcessorConfiguration httpProcessorConfiguration = ConfigurationHelper.LoadHttpProcessorConfiguration(sink, hostSuffixesConfigParamName, enableStorageDomainNamesConfigParamName);

            HttpProcessorConfiguration.DefaultHttpProcessorConfiguration = httpProcessorConfiguration;
            return(httpProcessorConfiguration);
        }
Пример #3
0
        public static HttpProcessorConfiguration LoadDefaultAccountFEHttpProcessorConfiguration(IServiceEntrySink sink)
        {
            HttpProcessorConfiguration httpProcessorConfiguration = new HttpProcessorConfiguration()
            {
                AllowPathStyleUris = true,
                ValidHostSuffixes  = new string[0],
                IncludeInternalDetailsInErrorResponses = ConfigurationHelper.GetConfigSetting <bool>(sink, "NephosIncludeInternalDetailsInErrorResponses", "Include internal details in error responses"),
                MaskClientIPAddressesInLog             = false
            };

            HttpProcessorConfiguration.DefaultHttpProcessorConfiguration = httpProcessorConfiguration;
            return(httpProcessorConfiguration);
        }
Пример #4
0
        public static HttpProcessorConfiguration GetTestHttpProcessorConfiguration()
        {
            HttpProcessorConfiguration httpProcessorConfiguration = new HttpProcessorConfiguration()
            {
                AllowPathStyleUris = true,
                ValidHostSuffixes  = new string[0],
                IncludeInternalDetailsInErrorResponses = true,
                EnableStorageDomainNames   = false,
                MaskClientIPAddressesInLog = false
            };

            HttpProcessorConfiguration.DefaultHttpProcessorConfiguration = httpProcessorConfiguration;
            return(httpProcessorConfiguration);
        }
Пример #5
0
        public static HttpProcessorConfiguration LoadDefaultStampAccountFEHttpProcessorConfiguration(IServiceEntrySink sink, string hostSuffixesConfigParamName)
        {
            HttpProcessorConfiguration httpProcessorConfiguration = new HttpProcessorConfiguration();

            string[] hostSuffixes = ConfigurationHelper.GetHostSuffixes(sink, hostSuffixesConfigParamName);
            httpProcessorConfiguration.ValidHostSuffixes = (hostSuffixes != null ? hostSuffixes : new string[0]);
            string configurationParameter = sink.GetConfigurationParameter("NephosAllowPathStyleUris");
            bool   flag = false;

            if (string.IsNullOrEmpty(configurationParameter))
            {
                Logger <IRestProtocolHeadLogger> .Instance.Critical.Log("{0} setting was not found for role", new object[] { "NephosAllowPathStyleUris" });
            }
            else if (!bool.TryParse(configurationParameter, out flag))
            {
                Logger <IRestProtocolHeadLogger> .Instance.Critical.Log("{0} setting with value {1} is not a boolean", new object[] { "NephosAllowPathStyleUris", configurationParameter });
            }
            httpProcessorConfiguration.AllowPathStyleUris = flag;
            httpProcessorConfiguration.IncludeInternalDetailsInErrorResponses = ConfigurationHelper.GetConfigSetting <bool>(sink, "NephosIncludeInternalDetailsInErrorResponses", "Include internal details in error responses");
            httpProcessorConfiguration.MaskClientIPAddressesInLog             = false;
            HttpProcessorConfiguration.DefaultHttpProcessorConfiguration      = httpProcessorConfiguration;
            return(httpProcessorConfiguration);
        }