Exemplo n.º 1
0
        public override void Initialize()
        {
            EnableSsl = GetBool("EnableSsl", false);
            EnableIndexConfiguration       = GetBool("EnableIndexConfiguration", true);
            EnableApplyDataSourceResources = GetBool("EnableApplyDataSourceResources", true);

            if (AppScope == null)
            {
                AppScope = String.Empty;
            }
            AppMode    = GetEnum <AppMode>("AppMode", AppMode.Local);
            AppScope   = GetString("AppScope", String.Empty);
            ApiUrl     = GetString("ApiUrl", "http://*****:*****@foundatio.com");
            AllowedOutboundAddresses = GetStringList("AllowedOutboundAddresses", "foundatio.com,slideroom.com,mailinator.com").Select(v => v.ToLower()).ToList();
            RunJobsInProcess         = GetBool("RunJobsInProcess", true);
            LogJobLocks       = GetBool("LogJobLocks", false);
            LogJobEvents      = GetBool("LogJobEvents", false);
            LogJobCompleted   = GetBool("LogJobCompleted", false);
            EnableSignalR     = GetBool("EnableSignalR", true);
            ApiThrottleLimit  = GetInt("ApiThrottleLimit", Int32.MaxValue);
            MetricsServer     = GetString("MetricsServer");
            MetricsServerPort = GetInt("MetricsServerPort", 8125);
            string environment = !AppScope.IsNullOrEmpty() ? AppScope : (AppMode == AppMode.Production ? "prod" : "qa");

            MetricsPrefix             = GetString("MetricsPrefix", environment + "-" + Environment.MachineName);
            EnableMetricsReporting    = GetBool("EnableMetrics", true);
            IntercomAppId             = GetString("IntercomAppId");
            IntercomAppSecret         = GetString("IntercomAppSecret");
            EnableAccountCreation     = GetBool("EnableAccountCreation", true);
            EnableAccountInvites      = GetBool("EnableAccountInvites", true);
            GoogleAppId               = GetString("GoogleAppId");
            GoogleAppSecret           = GetString("GoogleAppSecret");
            MicrosoftAppId            = GetString("MicrosoftAppId");
            MicrosoftAppSecret        = GetString("MicrosoftAppSecret");
            FacebookAppId             = GetString("FacebookAppId");
            FacebookAppSecret         = GetString("FacebookAppSecret");
            GitHubAppId               = GetString("GitHubAppId");
            GitHubAppSecret           = GetString("GitHubAppSecret");
            TwitterAuthorizationToken = GetString("TwitterAuthorizationToken", "AAAAAAAAAAAAAAAAAAAAAJfGewAAAAAA2W0TL6w2eO%2B7eJvzsM5e%2BDaSt3A%3DRVa0RVBzDwu3NhRz6cDWEaoT5t97fqjCFH2TgD2rcIUC6BPJkL");
            ClearbitToken             = GetString("ClearbitToken", "8eb88fc4c70a0635e70bdc776f7d68c1");
            StripeApiKey              = GetString("StripeApiKey");
            GeocodeApiKey             = GetString("GeocodeApiKey");
            EnableGeocoding           = GetBool("EnableGeocoding", !String.IsNullOrEmpty(GeocodeApiKey));
            StripePublishableApiKey   = GetString("StripePublishableApiKey");
            StorageFolder             = GetString("StorageFolder", "|DataDirectory|\\storage");
            PublicStorageUrlPrefix    = GetString("PublicStorageUrlPrefix", "http://localhost:51000/" + AppScopePrefix + "public");
            if (PublicStorageUrlPrefix.EndsWith("/"))
            {
                PublicStorageUrlPrefix = PublicStorageUrlPrefix.TrimEnd('/');
            }
            MailUser            = GetString("MailUser");
            MailPassword        = GetString("MailPassword");
            PassPhrase          = GetString("PassPhrase");
            BulkBatchSize       = GetInt("BulkBatchSize", 1000);
            ExceptionlessApiKey = GetString("ExceptionlessApiKey", "gUgqSb34oNAW80wKje6cDFRQnLynUz4idSSjuUPD");

            RedisConnectionString = GetConnectionString("RedisConnectionString");
            EnableRedis           = GetBool("EnableRedis", !String.IsNullOrEmpty(RedisConnectionString));

            PrivateAzureStorageConnectionString = GetConnectionString("PrivateAzureStorageConnectionString");
            PrivateAzureStorageContainerName    = GetString("PrivateAzureStorageContainerName") ?? AppScopePrefix + "private";
            PublicAzureStorageConnectionString  = GetConnectionString("PublicAzureStorageConnectionString", PrivateAzureStorageConnectionString);
            PublicAzureStorageContainerName     = GetString("PublicAzureStorageContainerName") ?? AppScopePrefix + "public";
            EnableAzureStorage = GetBool("EnableAzureStorage", !String.IsNullOrEmpty(PrivateAzureStorageConnectionString));

            PrivateS3StorageConnectionString = GetConnectionString("PrivateS3StorageConnectionString");
            PublicS3StorageConnectionString  = GetConnectionString("PublicS3StorageConnectionString", PrivateS3StorageConnectionString);
            bool isSingleS3 = PrivateS3StorageConnectionString == PublicS3StorageConnectionString;

            PrivateS3StorageFolder = GetString("PrivateS3StorageFolder") ?? (isSingleS3 ? "private/" + AppScope : AppScope);
            if (PrivateS3StorageFolder.EndsWith("/"))
            {
                PrivateS3StorageFolder = PrivateS3StorageFolder.TrimEnd('/');
            }
            PublicS3StorageFolder = GetString("PublicS3StorageFolder") ?? (isSingleS3 ? "public/" + AppScope : AppScope);
            if (PublicS3StorageFolder.EndsWith("/"))
            {
                PublicS3StorageFolder = PublicS3StorageFolder.TrimEnd('/');
            }
            EnableS3Storage = GetBool("EnableS3Storage", !String.IsNullOrEmpty(PrivateS3StorageConnectionString));

            ElasticSearchConnectionString = GetConnectionString("ElasticSearchConnectionString", "http://localhost:9200");

            try {
                var versionInfo = FileVersionInfo.GetVersionInfo(typeof(Settings).Assembly.Location);
                Version = versionInfo.FileVersion;
                InformationalVersion = versionInfo.ProductVersion;
            } catch { }
        }