Example #1
0
        static void Main(string[] args)
        {
            var rand = new Random();

            var paramsProvider = new AppConfigProvider(ConfigurationManager.AppSettings);
            var configProvider = new ConfigurationProvider();
            var configFactory = new ConfigurationFactory(new ClientParams(paramsProvider), configProvider);

            var clientConfig = configFactory.Create<ClientConfiguration>();
            clientConfig.Port = rand.Next()%1000 + 25000;

            LogManager.Debug("Address is : 127.0.0.1:{0}", clientConfig.Port);

            var client = new Client(clientConfig);

            client.Start(Console.ReadLine(), () =>
            {
                var small = SmallTestObject.Create();
                while (true)
                {
                    var key = Console.ReadKey();
                    if (key.Key == ConsoleKey.Enter)
                        break;

                    small.Message = key.KeyChar.ToString();
                    client.SendObject(small);
                }
            });
        }
        static void StartSimulator()
        {
            // Dependencies to inject into the Bulk Device Tester
            var logger = new TraceLogger();
            var configProvider = new ConfigurationProvider();
            var telemetryFactory = new EngineTelemetryFactory(logger, configProvider);

            var serializer = new JsonSerialize();
            var transportFactory = new IotHubTransportFactory(serializer, logger, configProvider);

            IVirtualDeviceStorage deviceStorage = null;
            var useConfigforDeviceList = Convert.ToBoolean(configProvider.GetConfigurationSettingValueOrDefault("UseConfigForDeviceList", "False"), CultureInfo.InvariantCulture);

            if (useConfigforDeviceList)
            {
                deviceStorage = new AppConfigRepository(configProvider, logger);
            }
            else
            {
                deviceStorage = new VirtualDeviceTableStorage(configProvider);
            }

            IDeviceFactory deviceFactory = new EngineDeviceFactory();

            // Start Simulator
            Trace.TraceInformation("Starting Simulator");
            var tester = new BulkDeviceTester(transportFactory, logger, configProvider, telemetryFactory, deviceFactory, deviceStorage);
            Task.Run(() => tester.ProcessDevicesAsync(cancellationTokenSource.Token), cancellationTokenSource.Token);
        }
Example #3
0
 public void Clone(Site @from, Site to, SiteCloneContext siteCloneContext)
 {
     var fromProvider = new ConfigurationProvider(@from, _legacySettingsProvider);
     var toProvider = new ConfigurationProvider(@to, _legacySettingsProvider);
     var siteSettingsBases = fromProvider.GetAllSiteSettings();
     siteSettingsBases.ForEach(toProvider.SaveSettings);
 }
Example #4
0
        static void Main(string[] args)
        {
            var paramsProvider = new AppConfigProvider(ConfigurationManager.AppSettings);
            var configProvider = new ConfigurationProvider();

            var factory = new ConfigurationFactory(new ServerParams(paramsProvider), configProvider);

            using(var server = new Server(factory.Create<ServerConfiguration>()))
                server.Listen();
        }
        public void Configuration(IAppBuilder app)
        {
            HttpConfiguration = new HttpConfiguration();
            ConfigurationProvider configProvider = new ConfigurationProvider();

            app.Use<EnforceHttpsMiddleware>();

            this.ConfigureAuth(app, configProvider);
            this.ConfigureAutofac(app);
            this.ConfigureWebApi(app);
        }
    public void CanUpdateAssemblyInformationalVersioningSchemeWithMultipleVariables()
    {
        const string text = @"
assembly-versioning-scheme: MajorMinor
assembly-file-versioning-scheme: MajorMinorPatch
assembly-informational-format: '{Major}.{Minor}.{Patch}'";

        SetupConfigFileContent(text);

        var config = ConfigurationProvider.Provide(repoPath, fileSystem);

        config.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinor);
        config.AssemblyFileVersioningScheme.ShouldBe(AssemblyFileVersioningScheme.MajorMinorPatch);
        config.AssemblyInformationalFormat.ShouldBe("{Major}.{Minor}.{Patch}");
    }
        public void Observe_with_external_source_should_invoke_settings_callback()
        {
            source.PushNewConfiguration(new ValueNode("value"));

            var callback = Substitute.For <Action <object, IConfigurationSource> >();

            provider = new ConfigurationProvider(new ConfigurationProviderSettings
            {
                SettingsCallback = callback
            });

            provider.Observe <string>(source).WaitFirstValue(10.Seconds());

            callback.Received(1).Invoke("value", source);
        }
Example #8
0
        private void InitTokenReplace()
        {
            var confProv = ConfigurationProvider.GetConfigProviderForModule(ModuleInfo.ModuleID, Sexy.App, Sexy);

            _tokenReplace = new TokenReplaceEav(App, ModuleInfo.ModuleID, PortalSettings.Current, confProv);

            // Add the Content and ListContent property sources used always
            _tokenReplace.ValueSources.Add(SourcePropertyName.ListContent, new DynamicEntityPropertyAccess(SourcePropertyName.ListContent, _dataHelper.ListContent));
            var contentProperty = _dataHelper.List.FirstOrDefault();

            if (contentProperty != null)
            {
                _tokenReplace.ValueSources.Add(SourcePropertyName.Content, new DynamicEntityPropertyAccess(SourcePropertyName.Content, contentProperty.Content));
            }
        }
        public static async Task TestAsync()
        {
            var owner = "#";
            var password = "******";
            var client = new GitHubClient(new ProductHeaderValue("tool"));
            client.Credentials = new Credentials(owner, password);
            var configuration = new ConfigurationProvider(owner, "github-create-repository-configuration");
            var config = await configuration.GetConfigurationAsync(client);
            System.Console.WriteLine(config.version);

            var task = new CreateNewRepositoryTask(client, config);
            var repository = await task.CreateAsync("hello-new-repo");
            System.Console.WriteLine("Browse the repository at: " + repository);
            System.Console.ReadLine();
        }
Example #10
0
        /// <summary>
        /// Get an app - but only allow zone change if super-user
        /// </summary>
        /// <returns></returns>
        internal static IApp GetAppAndCheckZoneSwitchPermissions(int zoneId, int appId, IUser user, int contextZoneId, ILog log)
        {
            var wrapLog = log.Call <IApp>($"superuser: {user.IsSuperUser}");

            if (!user.IsSuperUser && zoneId != contextZoneId)
            {
                wrapLog("error", null);
                throw Eav.WebApi.Errors.HttpException.PermissionDenied("Tried to access app from another zone. Requires SuperUser permissions.");
            }

            var app = Factory.Resolve <Apps.App>().Init(new AppIdentity(zoneId, appId),
                                                        ConfigurationProvider.Build(true, true, new LookUpEngine(log)), true, log);

            return(wrapLog(null, app));
        }
Example #11
0
 public CSVDataSourceMap()
 {
     _config = ConfigurationProvider.GetConfigSettings();
     Map(m => m.TableName).Name(_config.CSVFileSettings.Single(e => string.Equals(e.FieldName, "Table Name", StringComparison.OrdinalIgnoreCase)).FieldValue);
     Map(m => m.Tags).Name(_config.CSVFileSettings.Single(e => string.Equals(e.FieldName, "Tags", StringComparison.OrdinalIgnoreCase)).FieldValue);
     Map(m => m.TableDefinition).Name(_config.CSVFileSettings.Single(e => string.Equals(e.FieldName, "Table Description", StringComparison.OrdinalIgnoreCase)).FieldValue);
     Map(m => m.ColumnName).Name(_config.CSVFileSettings.Single(e => string.Equals(e.FieldName, "Column Name", StringComparison.OrdinalIgnoreCase)).FieldValue);
     Map(m => m.HashdiffColumns).Name(_config.CSVFileSettings.Single(e => string.Equals(e.FieldName, "Hashdiff Columns", StringComparison.OrdinalIgnoreCase)).FieldValue);
     Map(m => m.ColumnDefinition).Name(_config.CSVFileSettings.Single(e => string.Equals(e.FieldName, "Column Description", StringComparison.OrdinalIgnoreCase)).FieldValue);
     Map(m => m.SourceModel).Name(_config.CSVFileSettings.Single(e => string.Equals(e.FieldName, "Source-Model", StringComparison.OrdinalIgnoreCase)).FieldValue);
     Map(m => m.StageColumns).Name(_config.CSVFileSettings.Single(e => string.Equals(e.FieldName, "Stage-Columns", StringComparison.OrdinalIgnoreCase)).FieldValue);
     Map(m => m.NullOption).Name(_config.CSVFileSettings.Single(e => string.Equals(e.FieldName, "Null-Option", StringComparison.OrdinalIgnoreCase)).FieldValue).Optional();
     Map(m => m.PrimaryKey).Name(_config.CSVFileSettings.Single(e => string.Equals(e.FieldName, "Primary-Key", StringComparison.OrdinalIgnoreCase)).FieldValue);
     Map(m => m.ForeignKey).Name(_config.CSVFileSettings.Single(e => string.Equals(e.FieldName, "Foreign-Key", StringComparison.OrdinalIgnoreCase)).FieldValue);
 }
Example #12
0
        public void CanUpdateAssemblyInformationalVersioningScheme()
        {
            const string text = @"
assembly-versioning-scheme: MajorMinor
assembly-file-versioning-scheme: MajorMinorPatch
assembly-informational-format: '{NugetVersion}'";

            SetupConfigFileContent(text);

            var config = ConfigurationProvider.Provide(repoPath, configFileLocator);

            config.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinor);
            config.AssemblyFileVersioningScheme.ShouldBe(AssemblyFileVersioningScheme.MajorMinorPatch);
            config.AssemblyInformationalFormat.ShouldBe("{NugetVersion}");
        }
Example #13
0
        public void GetDocument_does_not_include_AutoGenerated_notice_if_the_includeAutoGeneratedNotice_setting_is_false()
        {
            var configuration = new ConfigurationProvider().GetDefaultCommandLineHelpConfiguration();

            configuration.Template.Default.IncludeAutoGeneratedNotice = false;

            var application = new SingleCommandApplicationDocumentation(name: "TestApp", "1.2.3")
            {
                Usage = new[] { "Usage line 1", "Usage line2" }
            };

            application = application.WithNamedParameter("parameter1", required: true);

            Approve(application, configuration);
        }
Example #14
0
        public void GetDocument_returns_expected_document_02()
        {
            var configuration = new ConfigurationProvider().GetDefaultCommandLineHelpConfiguration();

            configuration.Template.Default.IncludeVersion = false;

            var application = new SingleCommandApplicationDocumentation(name: "TestApp", "1.2.3")
            {
                Usage = new[] { "Usage line 1", "Usage line2" }
            };

            application = application.WithNamedParameter("parameter1", required: true);

            Approve(application, configuration);
        }
    public void CanReadDefaultDocument()
    {
        const string text = "";

        SetupConfigFileContent(text);
        var config = ConfigurationProvider.Provide(repoPath, fileSystem);

        config.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinorPatch);
        config.AssemblyFileVersioningScheme.ShouldBe(AssemblyFileVersioningScheme.MajorMinorPatch);
        config.AssemblyInformationalFormat.ShouldBe(null);
        config.Branches["develop"].Tag.ShouldBe("alpha");
        config.Branches["release"].Tag.ShouldBe("beta");
        config.TagPrefix.ShouldBe(ConfigurationProvider.DefaultTagPrefix);
        config.NextVersion.ShouldBe(null);
    }
Example #16
0
        public bool GetChaveamento()
        {
            string chaveUsarVimeoGeral = ConfigurationProvider.Get("Settings:AtivarVimeoGeral");

            if (!string.IsNullOrEmpty(chaveUsarVimeoGeral) && Convert.ToBoolean(chaveUsarVimeoGeral))
            {
                string chaveUsarVimeoSimulado = ConfigurationProvider.Get("Settings:AtivarVimeoComentarioQuestao");
                if (!string.IsNullOrEmpty(chaveUsarVimeoSimulado) && Convert.ToBoolean(chaveUsarVimeoSimulado))
                {
                    return(true);
                }
            }

            return(false);
        }
Example #17
0
        public static ConnectionFactory CreateConnection()
        {
            RabbitSettingModel rabbitSettingModel = ConfigurationProvider.GetSettingModel <RabbitSettingModel>("RabbitMQ");
            ConnectionFactory  connectionFactory  = new ConnectionFactory()
            {
                HostName                = rabbitSettingModel.HostName,
                Port                    = rabbitSettingModel.Port,
                UserName                = rabbitSettingModel.UserName,
                Password                = rabbitSettingModel.Password,
                VirtualHost             = rabbitSettingModel.VirtualHost,
                NetworkRecoveryInterval = TimeSpan.FromSeconds(10)
            };

            return(connectionFactory);
        }
Example #18
0
 public OrderController(
     LookUpProvider lookUpProvider,
     OrderProvider orderProvider,
     TableProvider tableProvider,
     ConfigurationProvider configurationProvider,
     ProductProvider productProvider,
     IMapper mapper)
 {
     this.productProvider       = productProvider;
     this.lookUpProvider        = lookUpProvider;
     this.orderProvider         = orderProvider;
     this.tableProvider         = tableProvider;
     this.configurationProvider = configurationProvider;
     this.mapper = mapper;
 }
        public void Given_I_Call_IgnoreFilesInBucketList_I_Get_The_Correct_Value_Back()
        {
            //arrange
            var configurationProvider = new ConfigurationProvider();

            //act
            var result = configurationProvider.IgnoreFilesInBucketList;

            //assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOf <List <string> >(result);
            Assert.AreEqual(2, result.Count);
            Assert.IsTrue(result.Contains("processed"));
            Assert.IsTrue(result.Contains("audit"));
        }
Example #20
0
        public void MaximumCacheSize_ValueIsNegative_Throws()
        {
            _gitExecutor.Setup(x => x.GetLong(GetConfigArgumentStringForInt(ConfigurationProvider.MaximumCacheSizeConfigName))).Returns(-42);

            try
            {
                var target = new ConfigurationProvider(_gitExecutor.Object);
            }
            catch (ಠ_ಠ)
            {
                Assert.Pass();
            }

            Assert.Fail("Exception not thrown for negative cache size");
        }
Example #21
0
    public void SourceBranchIsRequired()
    {
        const string text = @"
next-version: 2.0.0
branches:
    bug:
        regex: 'bug[/-]'
        tag: bugfix";

        SetupConfigFileContent(text);
        var ex = Should.Throw <GitVersionConfigurationException>(() => ConfigurationProvider.Provide(repoPath, fileSystem, configFileLocator));

        ex.Message.ShouldBe("Branch configuration 'bug' is missing required configuration 'source-branches'\n\n" +
                            "See http://gitversion.readthedocs.io/en/latest/configuration/ for more info");
    }
Example #22
0
        public bool GetChaveamento()
        {
            string chaveUsarVimeoGeral = ConfigurationProvider.Get("Settings:AtivarVimeoGeral");

            if (!string.IsNullOrEmpty(chaveUsarVimeoGeral) && Convert.ToBoolean(chaveUsarVimeoGeral))
            {
                string chaveUsarVimeoMediMiolo = ConfigurationProvider.Get("Settings:AtivarVimeoAulaDeRevisao");
                if (!string.IsNullOrEmpty(chaveUsarVimeoMediMiolo) && Convert.ToBoolean(chaveUsarVimeoMediMiolo))
                {
                    return(true);
                }
            }

            return(false);
        }
Example #23
0
    public void WarnOnExistingGitVersionConfigYamlFile(string path)
    {
        SetupConfigFileContent(string.Empty, ConfigurationProvider.ObsoleteConfigFileName, path);

        var             logOutput = string.Empty;
        Action <string> action    = info => { logOutput = info; };

        using (Logger.AddLoggersTemporarily(action, action, action))
        {
            ConfigurationProvider.Verify(workingPath, repoPath, fileSystem);
        }
        var configFileDeprecatedWarning = string.Format("{0}' is deprecated, use '{1}' instead", ConfigurationProvider.ObsoleteConfigFileName, ConfigurationProvider.DefaultConfigFileName);

        logOutput.Contains(configFileDeprecatedWarning).ShouldBe(true);
    }
Example #24
0
    public void CanProvideConfigForNewBranch()
    {
        const string text = @"
next-version: 2.0.0
branches:
    bug:
        regex: 'bug[/-]'
        tag: bugfix";

        SetupConfigFileContent(text);
        var config = ConfigurationProvider.Provide(repoPath, fileSystem);

        config.Branches["bug"].Regex.ShouldBe("bug[/-]");
        config.Branches["bug"].Tag.ShouldBe("bugfix");
    }
Example #25
0
        public void Clone(Site @from, Site to, SiteCloneContext siteCloneContext)
        {
            var toProvider = new ConfigurationProvider(@to, _legacySettingsProvider);
            var pageDefaultsSettings = toProvider.GetSiteSettings<PageDefaultsSettings>();

            var keys = pageDefaultsSettings.Layouts.Keys.ToList();
            foreach (var key in keys.Where(key => pageDefaultsSettings.Layouts[key].HasValue))
            {
                var layout = siteCloneContext.FindNew<Layout>(pageDefaultsSettings.Layouts[key].Value);
                if (layout != null)
                    pageDefaultsSettings.Layouts[key] = layout.Id;
            }

            toProvider.SaveSettings(pageDefaultsSettings);
        }
Example #26
0
        public void CacheDirectory_NoValue_Throws()
        {
            _gitExecutor.Setup(x => x.GetString("rev-parse --git-dir")).Returns(string.Empty);

            try
            {
                var target = new ConfigurationProvider(_gitExecutor.Object);
            }
            catch (ಠ_ಠ)
            {
                Assert.Pass();
            }

            Assert.Fail("Exception not thrown for CacheDir");
        }
Example #27
0
        /// <summary>Called when this mod is enabled.</summary>
        public void OnEnabled()
        {
            Log.SetupDebug(Name, LogCategory.Generic, LogCategory.Simulation);

            if (string.IsNullOrEmpty(modPath))
            {
                Log.Info($"The 'Real Time' mod version {modVersion} cannot be started because of no Steam Workshop");
                return;
            }

            Log.Info("The 'Real Time' mod has been enabled, version: " + modVersion);
            configProvider = new ConfigurationProvider <RealTimeConfig>(RealTimeConfig.StorageId, Name, () => new RealTimeConfig(latestVersion: true));
            configProvider.LoadDefaultConfiguration();
            localizationProvider = new LocalizationProvider(Name, modPath);
        }
Example #28
0
    public void CanUpdateAssemblyInformationalVersioningSchemeWithFullSemVer()
    {
        const string text = @"assembly-versioning-scheme: MajorMinorPatch
assembly-informational-format: '{FullSemVer}'
mode: ContinuousDelivery
next-version: 5.3.0
branches: {}";

        SetupConfigFileContent(text);

        var config = ConfigurationProvider.Provide(repoPath, fileSystem);

        config.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinorPatch);
        config.AssemblyInformationalFormat.ShouldBe("{FullSemVer}");
    }
Example #29
0
        private void _constructor(IContentBlock parent, Eav.Interfaces.IEntity cbDefinition)
        {
            Parent = parent;
            ParseContentBlockDefinition(cbDefinition);
            ParentId       = parent.ParentId;
            ContentBlockId = -cbDefinition.EntityId;

            // Ensure we know what portal the stuff is coming from
            Tenant = Parent.App.Tenant;

            ZoneId = Parent.ZoneId;

            AppId = AppHelpers.GetAppIdFromGuidName(ZoneId, _appName); // should be 0 if unknown, must test

            if (AppId == Settings.DataIsMissingInDb)
            {
                _dataIsMissing = true;
                return;
            }

            if (AppId == 0)
            {
                return;
            }

            // try to load the app - if possible
            App = new App(Tenant, ZoneId, AppId);

            Configuration = ConfigurationProvider.GetConfigProviderForModule(ParentId, App, SxcInstance);

            // maybe ensure that App.Data is ready
            var userMayEdit = SxcInstance.UserMayEdit;// Factory.Resolve<IPermissions>().UserMayEditContent(SxcInstance.InstanceInfo);

            App.InitData(userMayEdit, SxcInstance.Environment.PagePublishing.IsEnabled(Parent.SxcInstance.EnvInstance.Id), Configuration);

            ContentGroup = App.ContentGroupManager.GetContentGroupOrGeneratePreview(_contentGroupGuid, _previewTemplateGuid);

            // handle cases where the content group is missing - usually because of uncomplete import
            if (ContentGroup.DataIsMissing)
            {
                _dataIsMissing = true;
                App            = null;
                return;
            }

            // use the content-group template, which already covers stored data + module-level stored settings
            SxcInstance.SetTemplateOrOverrideFromUrl(ContentGroup.Template);
        }
Example #30
0
        public void DecorateMessage(TransportMailItem message)
        {
            message.HeloDomain           = ConfigurationProvider.GetDefaultDomainName();
            message.ReceiveConnectorName = "FromLocal";
            message.RefreshMimeSize();
            long       mimeSize = message.MimeSize;
            HeaderList headers  = message.RootPart.Headers;

            if (!(headers.FindFirst(HeaderId.Date) is DateHeader))
            {
                DateHeader newChild = new DateHeader("Date", DateTime.UtcNow.ToLocalTime());
                headers.AppendChild(newChild);
            }
            headers.RemoveAll(HeaderId.Received);
            DateHeader     dateHeader = new DateHeader("Date", DateTime.UtcNow.ToLocalTime());
            string         value      = dateHeader.Value;
            ReceivedHeader newChild2  = new ReceivedHeader(this.SourceServerFqdn, SubmissionItemBase.FormatIPAddress(this.SourceServerNetworkAddress), this.LocalIP.HostName, this.ReceivedHeaderTcpInfo, null, this.mailProtocol, SubmissionItemBase.serverVersion, null, value);

            headers.PrependChild(newChild2);
            message.ExtendedProperties.SetValue <bool>("Microsoft.Exchange.Transport.ElcJournalReport", this.IsElcJournalReport);
            if (this.IsMapiAdminSubmission)
            {
                headers.AppendChild(new AsciiTextHeader("X-MS-Exchange-Organization-Mapi-Admin-Submission", string.Empty));
            }
            if (this.IsDlExpansionProhibited)
            {
                headers.AppendChild(new AsciiTextHeader("X-MS-Exchange-Organization-DL-Expansion-Prohibited", string.Empty));
            }
            headers.AppendChild(new AsciiTextHeader("X-MS-Exchange-Organization-Processed-By-MBTSubmission", string.Empty));
            if (ConfigurationProvider.GetForwardingProhibitedFeatureStatus() && this.IsAltRecipientProhibited)
            {
                headers.AppendChild(new AsciiTextHeader("X-MS-Exchange-Organization-Alt-Recipient-Prohibited", string.Empty));
            }
            headers.RemoveAll("X-MS-Exchange-Organization-OriginalSize");
            headers.AppendChild(new AsciiTextHeader("X-MS-Exchange-Organization-OriginalSize", mimeSize.ToString(NumberFormatInfo.InvariantInfo)));
            headers.RemoveAll("X-MS-Exchange-Organization-OriginalArrivalTime");
            Header newChild3 = new AsciiTextHeader("X-MS-Exchange-Organization-OriginalArrivalTime", Util.FormatOrganizationalMessageArrivalTime(this.OriginalCreateTime));

            headers.AppendChild(newChild3);
            headers.RemoveAll("X-MS-Exchange-Organization-MessageSource");
            Header newChild4 = new AsciiTextHeader("X-MS-Exchange-Organization-MessageSource", "StoreDriver");

            headers.AppendChild(newChild4);
            headers.AppendChild(new AsciiTextHeader("X-MS-Exchange-Transport-FromEntityHeader", RoutingEndpoint.Hosted.ToString()));
            headers.AppendChild(new AsciiTextHeader("X-MS-Exchange-Organization-FromEntityHeader", RoutingEndpoint.Hosted.ToString()));
            message.Directionality = MailDirectionality.Originating;
            message.UpdateDirectionalityAndScopeHeaders();
        }
Example #31
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseSwagger();

            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "ToDo API V1");
                c.OAuthClientId("Swagger");
                c.OAuthAppName("ToDo.Web");
                c.OAuthScopeSeparator(" ");
                c.OAuthUsePkce();
                c.ConfigObject.DeepLinking = true;
            });

            app.UseRouting();

            app.UseCors(builder =>
            {
                builder.WithOrigins(Configuration["Cors:Origin"])
                .AllowAnyMethod()
                .AllowAnyHeader();
            });

            app.UseAuthentication();
            app.UseIdentityServer();
            app.UseAuthorization();
            app.UseEndpoints(endpoints =>
            {
                //endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
                endpoints.MapControllerRoute("default", "{controller=Task}/{action=Api}/{GetTasks}");
                endpoints.MapRazorPages();
                var provider = new ConfigurationProvider <IEndpointRouteBuilder>();
                provider.Configure(endpoints);
            });
        }
    public void CanReadOldDocument()
    {
        const string text = @"
assemblyVersioningScheme: MajorMinor
develop-branch-tag: alpha
release-branch-tag: rc
";

        SetupConfigFileContent(text);
        var error = Should.Throw <OldConfigurationException>(() => ConfigurationProvider.Provide(repoPath, fileSystem));

        error.Message.ShouldContainWithoutWhitespace(@"GitVersionConfig.yaml contains old configuration, please fix the following errors:
assemblyVersioningScheme has been replaced by assembly-versioning-scheme
develop-branch-tag has been replaced by branch specific configuration.See https://github.com/ParticularLabs/GitVersion/wiki/Branch-Specific-Configuration
release-branch-tag has been replaced by branch specific configuration.See https://github.com/ParticularLabs/GitVersion/wiki/Branch-Specific-Configuration");
    }
Example #33
0
    public void CanReadOldDocument()
    {
        const string text = @"
assemblyVersioningScheme: MajorMinor
develop-branch-tag: alpha
release-branch-tag: rc
";

        SetupConfigFileContent(text);
        var error = Should.Throw <OldConfigurationException>(() => ConfigurationProvider.Provide(repoPath, fileSystem));

        error.Message.ShouldContainWithoutWhitespace(@"GitVersion configuration file contains old configuration, please fix the following errors:
assemblyVersioningScheme has been replaced by assembly-versioning-scheme
develop-branch-tag has been replaced by branch specific configuration.See http://gitversion.readthedocs.org/en/latest/configuration/#branch-configuration
release-branch-tag has been replaced by branch specific configuration.See http://gitversion.readthedocs.org/en/latest/configuration/#branch-configuration");
    }
Example #34
0
 static void Main(string[] args)
 {
     try
     {
         var configurationProvider = new ConfigurationProvider();
         var service = new SmtpStub(configurationProvider);
         service.Init();
         Console.WriteLine("SMTP Stub listening on port " + configurationProvider.ListeningPort);
         Console.WriteLine("A (.) will print for each message received.");
         Console.WriteLine("Message dumps are placed in " + configurationProvider.LoggingDirectory);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Example #35
0
 public AppsService(
     AuthDbContext authDbContext,
     IDataProtectionProvider dataProtectionProvider,
     SecureRandom secureRandom,
     ConfigurationProvider configurationProvider,
     MemoryPopulator memoryPopulator,
     ISyncHandler syncHandler
     )
 {
     _authDbContext             = authDbContext;
     _ldapSettingsDataProtector = dataProtectionProvider.CreateProtector("LdapSettingsDataProtector");
     _secureRandom          = secureRandom;
     _configurationProvider = configurationProvider;
     _memoryPopulator       = memoryPopulator;
     _syncHandler           = syncHandler;
 }
Example #36
0
        public static void InitializeClass(TestContext context)
        {
            BaseAddress = "http://api.angel.co/1";

            IRestClient restClient = new SimpleRestClient();

            AngelListClient = new JsonNetAngelListClient(BaseAddress, restClient);

            defaultLogWriter = EnterpriseLibraryContainer.Current.GetInstance <LogWriter>();

            ConfigurationProvider config = new ConfigurationProvider();

            config.Add(ConfigName.SqlConnectionString, Screen.Vc.DataAccess.Investors.Properties.Settings.Default.ScreenVcConnectionString);
            config.Add(ConfigName.SqlConnectTimeoutInSeconds, Screen.Vc.DataAccess.Investors.Properties.Settings.Default.SqlConnectTimeoutInSeconds);
            sqlCommonTasks = new SqlCommonTasks(config);
        }
        public void Init(HttpApplication context)
        {
            context.PreSendRequestHeaders += PreSendRequestHeaders;

            var configurationProvider = new ConfigurationProvider();

            // Get role id
            string roleId = configurationProvider.GetRoleId();
            Match match = _instanceIdFormat.Match(roleId);
            _roleId = match.Success ? match.Groups[1].Value : null;

            // Get assembly version
            Assembly assembly = Assembly.GetExecutingAssembly();
            string version = FileVersionInfo.GetVersionInfo(assembly.Location).ProductVersion;

            // Select version number
            match = _versionFormat.Match(version);
            Version = match.Success ? match.Groups[1].Value : version;
        }
        public void CanReadRangeWhenOnlyMinSet()
        {
            TestAppConfigContext testContext = BuildA.NewTestAppConfig(@"<?xml version=""1.0""?>
            <configuration>
              <configSections>
                <section name=""customFilter"" type=""Config.Sections.FilterConfigurationSection, Config""/>
              </configSections>
              <customFilter>
                <range min=""1"" />
              </customFilter>
            </configuration>");

            var configurationProvider = new ConfigurationProvider(testContext.ConfigFilePath);
            var filterConfigSection = configurationProvider.Read<FilterConfigurationSection>(FilterConfigurationSection.SectionName);

            filterConfigSection.Range.Min.Should().Be(1);
            filterConfigSection.Range.Max.Should().Be(100);

            testContext.Destroy();
        }
Example #39
0
        public static void Queue(Site site)
        {
            if (!HostingEnvironment.IsHosted)
                return;
            HostingEnvironment.QueueBackgroundWorkItem(async x =>
            {
                var siteSettings = new ConfigurationProvider(site, null).GetSiteSettings<SiteSettings>();

                if (siteSettings.SelfExecuteTasks)
                {
                    string url = String.Format("{0}/execute-pending-tasks?{1}={2}", site.GetFullDomain.TrimEnd('/'),
                        siteSettings.TaskExecutorKey,
                        siteSettings.TaskExecutorPassword);
                    await new HttpClient().GetAsync(url, x);
                }

                await Task.Delay(TimeSpan.FromSeconds(siteSettings.TaskExecutionDelay), x);
                Queue(site);
            });
        }
Example #40
0
        public void Clone(Site @from, Site to, SiteCloneContext siteCloneContext)
        {
            var fromProvider = new ConfigurationProvider(@from, _legacySettingsProvider);
            var fromSiteSettings = fromProvider.GetSiteSettings<SiteSettings>();
            var toProvider = new ConfigurationProvider(@to, _legacySettingsProvider);
            var toSiteSettings = toProvider.GetSiteSettings<SiteSettings>();

            var error403 = siteCloneContext.FindNew<Webpage>(fromSiteSettings.Error403PageId);
            if (error403 != null) toSiteSettings.Error403PageId = error403.Id;

            var error404 = siteCloneContext.FindNew<Webpage>(fromSiteSettings.Error404PageId);
            if (error404 != null) toSiteSettings.Error404PageId = error404.Id;

            var error500 = siteCloneContext.FindNew<Webpage>(fromSiteSettings.Error500PageId);
            if (error500 != null) toSiteSettings.Error500PageId = error500.Id;

            var layout = siteCloneContext.FindNew<Layout>(fromSiteSettings.DefaultLayoutId);
            if (layout != null) toSiteSettings.DefaultLayoutId = layout.Id;

            toProvider.SaveSettings(toSiteSettings);
        }
Example #41
0
 /// <summary>
 /// Creates a GMIStudyClient that will call the GMIStudy service
 /// </summary>
 /// <returns></returns>
 internal static LSR.WebClient.GMIStudy.RpcClient GetGMIStudyClient()
 {
     var p = new ConfigurationProvider(UserInformation);
     var client = new LSR.WebClient.GMIStudy.RpcClient(p);
     return client;
 }
        public void Can_save_a_settings_object()
        {
            var testSetting = new TestSetting();
            testSetting.Decimal = (decimal) 3;
            testSetting.Enum = TestSetting.TestEnumType.TestValue2;
            testSetting.Integer = (int) 4;
            testSetting.Long = (long) 5;
            testSetting.String = "String...";

            _settingService.SaveSetting(testSetting);
            testSetting = new ConfigurationProvider<TestSetting>(_settingService).Settings;

            testSetting.Decimal.ShouldEqual((decimal) 3);
            testSetting.Enum.ShouldEqual(TestSetting.TestEnumType.TestValue2);
            testSetting.Integer.ShouldEqual((int) 4);
            testSetting.Long.ShouldEqual((long) 5);
            testSetting.String.ShouldEqual("String...");
        }
 public void SetUp()
 {
     _configProvider = new ConfigurationProvider();
 }
        internal static LSR.WebClient.RespondentCatalog.RpcClient GetRespWebClient()
        {
            var p = new ConfigurationProvider(UserInformation);
            var client = new LSR.WebClient.RespondentCatalog.RpcClient(p);

            return client;
        }
		private Configuration LoadConfiguration()
		{
			try
			{
				var configurationProvider = new ConfigurationProvider();
				return configurationProvider.GetConfiguration();
			}
			catch (ConfigurationErrorsException)
			{
				return null;
			}
		}
Example #46
0
        public ConfigurationViewModel()
        {
            Mapper.CreateMap<ConfigurationViewModel, ConfigSettings>();

            ConfigurationProvider cp = new ConfigurationProvider();
            var cs = cp.Load();

            if (cs != null)
            {
                _rootContentDirectory = cs.RootContentDirectory;
                _showGifFiles = cs.ShowGifFiles;
                _showJpgFiles = cs.ShowJpgFiles;
                _showMp4Files = cs.ShowMp4Files;
                _showPngFiles = cs.ShowPngFiles;
                _showWmvFiles = cs.ShowWmvFiles;
                _isTouchEnabled = cs.EnableTouchScreen;
                _isDiagnosticsEnabled = cs.EnableDiagnostics;

                _zones = new ObservableCollection<ZoneDefinition>();
                if (cs.ZoneDefinitions != null)
                { 
                    foreach (var z in cs.ZoneDefinitions)
                    {
                        _zones.Add(z);
                    }
                }
            }

        }
 /// <summary>
 /// Creates a CSSProvidersUser that will call the CSSProviders service
 /// </summary>
 /// <returns></returns>
 internal static LSR.WebClient.CSSProviders.RpcClient GetCSSProviderClient()
 {
     var p = new ConfigurationProvider(UserInformation);
     var client = new LSR.WebClient.CSSProviders.RpcClient(p);
     return client;
 }
 /// <summary>
 /// Creates a HummingbirdUserClient that will call the HummingbirdUser service
 /// </summary>
 /// <returns></returns>
 internal static LSR.WebClient.HummingbirdUser.RpcClient GetHummingbirdUserClient()
 {
     var p = new ConfigurationProvider(UserInformation);
     var client = new LSR.WebClient.HummingbirdUser.RpcClient(p);
     return client;
 }
Example #49
0
        private void SaveText()
        {
            ConfigSettings cs = Mapper.Map<ConfigurationViewModel, ConfigSettings>(this);

            if (string.IsNullOrEmpty(cs.RootContentDirectory) || !Directory.Exists(cs.RootContentDirectory))
            {
                Status = "Invalid Root Directory.  File not saved.";
                return;
            }

            if (cs.ZoneDefinitions.Count() == 0)
            {
                Status = "Must create at least one zone.  File not saved.";
                return;
            }

            ConfigurationProvider cp = new ConfigurationProvider();
            Status = cp.WriteFile(cs);
        }
        /// <summary>
        /// Called by the service fabric when the listener is to be started
        /// </summary>
        /// <param name="cancellationToken">A token to monitor for abort requests</param>
        /// <returns>A task that completes when the service is openned</returns>
        public async Task<string> OpenAsync(CancellationToken cancellationToken)
        {
            string publishAddress = null;
            Guid traceId = Guid.NewGuid();
            int threadCount = Environment.ProcessorCount;
            this.serverControl = new CancellationTokenSource();
            GatewayConfiguration configuration = this.configurationProvider.Config;

            this.logger.Informational(traceId, this.componentName, "OpenAsync() invoked.");

            var iotHubConfigurationProvider = new ConfigurationProvider<IoTHubConfiguration>(traceId, this.serviceContext.ServiceName, this.serviceContext.CodePackageActivationContext, this.logger, "IoTHubClient");
            iotHubConfigurationProvider.ConfigurationChangedEvent += (sender, args) => this.unsupportedConfigurationChangeCallback?.Invoke();
            iotHubConfigurationProvider.ConfigurationPropertyChangedEvent += (sender, args) => this.unsupportedConfigurationChangeCallback?.Invoke();
            IoTHubConfiguration iotHubConfiguration = iotHubConfigurationProvider.Config;

            X509Certificate2 certificate = this.GetServerCertificate(configuration);
            this.logger.Informational(traceId, this.componentName, "Certificate retrieved.");

            var mqttConfigurationProvider = new ConfigurationProvider<MqttServiceConfiguration>(traceId, this.serviceContext.ServiceName, this.serviceContext.CodePackageActivationContext, this.logger, "Mqtt");
            mqttConfigurationProvider.ConfigurationChangedEvent += (sender, args) => this.unsupportedConfigurationChangeCallback?.Invoke();
            mqttConfigurationProvider.ConfigurationPropertyChangedEvent += (sender, args) => this.unsupportedConfigurationChangeCallback?.Invoke();
            MqttServiceConfiguration mqttConfiguration = mqttConfigurationProvider.Config;
            
            if (mqttConfiguration != null)
            {
                var mqttInboundTemplates = new List<string>(mqttConfiguration.MqttInboundTemplates);
                var mqttOutboundTemplates = new List<string>(mqttConfiguration.MqttOutboundTemplates);

                ISessionStatePersistenceProvider qosSessionProvider = await this.GetSessionStateProviderAsync(traceId, mqttConfiguration).ConfigureAwait(false);
                IQos2StatePersistenceProvider qos2SessionProvider = await this.GetQos2StateProvider(traceId, mqttConfiguration).ConfigureAwait(false);

                this.logger.Informational(traceId, this.componentName, "QOS Providers instantiated.");

                var settingsProvider = new ServiceFabricConfigurationProvider(traceId, this.componentName, this.logger, configuration, iotHubConfiguration, mqttConfiguration);
                this.bootStrapper = new Bootstrapper(settingsProvider, qosSessionProvider, qos2SessionProvider, mqttInboundTemplates, mqttOutboundTemplates);
                this.runTask = this.bootStrapper.RunAsync(certificate, threadCount, this.serverControl.Token);

                publishAddress = this.BuildPublishAddress(configuration);

                this.logger.Informational(traceId, this.componentName, "Bootstrapper instantiated.");
            }
            else
            {
                this.logger.Critical(traceId, this.componentName, "Failed to start endpoint because Mqtt service configuration is missing.");
            }

            return publishAddress;
        }
        /// <summary>
        /// Retrieves the session state provider to be used for MQTT Sessions
        /// </summary>
        /// <param name="traceId">A unique identifier used to correlate debugging and diagnostics messages</param>
        /// <param name="configuration">The gateway configuration</param>
        /// <returns>A session state persistence provider if available</returns>
        async Task<ISessionStatePersistenceProvider> GetSessionStateProviderAsync(Guid traceId, MqttServiceConfiguration configuration)
        {
            ISessionStatePersistenceProvider stateProvider = null;

            this.logger.Informational(traceId, this.componentName, "QOS state provider requested.");

            switch (configuration.MqttQoSStateProvider)
            {
                case MqttServiceConfiguration.QosStateType.AzureStorage:
                    this.logger.Informational(traceId, this.componentName, "QOS state provider requested was Azure Storage.");
                    var azureConfigurationProvider = new ConfigurationProvider<AzureSessionStateConfiguration>(traceId, this.serviceContext.ServiceName, this.serviceContext.CodePackageActivationContext, this.logger, "AzureState");

                    azureConfigurationProvider.ConfigurationChangedEvent += (sender, args) => this.unsupportedConfigurationChangeCallback?.Invoke();
                    azureConfigurationProvider.ConfigurationPropertyChangedEvent += (sender, args) => this.unsupportedConfigurationChangeCallback?.Invoke();

                    AzureSessionStateConfiguration azureConfiguration = azureConfigurationProvider.Config;

                    if (azureConfiguration == null)
                    {
                        this.logger.Critical(traceId, this.componentName, "QOS state provider or configuration could not be retrieved.");
                        throw new ApplicationException("Azure state QoS provider configuration could not be retrieved");
                    }

                    stateProvider = await BlobSessionStatePersistenceProvider.CreateAsync(azureConfiguration.BlobConnectionString, azureConfiguration.ContainerName).ConfigureAwait(false);
                    this.logger.Informational(traceId, this.componentName, "QOS state provider request complete.");
                    break;

                case MqttServiceConfiguration.QosStateType.ServiceFabricStateful:
                    this.logger.Critical(traceId, this.componentName, "QOS state provider requested was Service Fabric Stateful Service but it is not currently implemented.");
                    throw new NotImplementedException("Only azure storage provider is supported");

                default:
                    this.logger.Critical(traceId, this.componentName, "QOS state provider requested was unknown.");
                    throw new ApplicationException("MQTT state provider must be specified in configuration.");
            }


            return stateProvider;
        }
        /// <summary>
        /// Retrieves the state provider for QoS 2 sessions
        /// </summary>
        /// <param name="traceId">A unique identifier used to correlate debugging and diagnostics messages</param>
        /// <param name="configuration">The gateway configuration</param>
        /// <returns>A Qos2 persistence  provider if available</returns>
        async Task<IQos2StatePersistenceProvider> GetQos2StateProvider(Guid traceId, MqttServiceConfiguration configuration)
        {
            IQos2StatePersistenceProvider stateProvider = null;

            this.logger.Informational(traceId, this.componentName, "QOS2 state provider requested.");

            switch (configuration.MqttQoS2StateProvider)
            {
                case MqttServiceConfiguration.QosStateType.AzureStorage:
                    this.logger.Informational(traceId, this.componentName, "QOS2 state provider requested was Azure Storage.");
                    AzureSessionStateConfiguration provider = new ConfigurationProvider<AzureSessionStateConfiguration>(traceId, this.serviceContext.ServiceName,
                                                                                this.serviceContext.CodePackageActivationContext, this.logger, "AzureState")?.Config;
                    if (provider == null)
                    {
                        this.logger.Critical(traceId, this.componentName, "QOS2 state provider or configuration could not be retrieved.");
                        throw new ApplicationException("Azure state QoS2 provider configuration could not be retrieved");
                    }

                    stateProvider = await TableQos2StatePersistenceProvider.CreateAsync(provider.TableConnectionString, provider.TableName).ConfigureAwait(false);
                    this.logger.Informational(traceId, this.componentName, "QOS2 state provider request complete.");
                    break;

                case MqttServiceConfiguration.QosStateType.ServiceFabricStateful:
                    this.logger.Critical(traceId, this.componentName, "QOS2 state provider requested was Service Fabric Stateful Service but it is not currently implemented.");
                    throw new NotImplementedException("Only azure storage provider is supported");

                default:
                    this.logger.Critical(traceId, this.componentName, "QOS2 state provider requested was unknown.");
                    throw new ApplicationException("MQTT state provider must be specified in configuration.");
            }


            return stateProvider;
        }
Example #53
0
        internal static LSR.WebClient.SampleManager.RpcClient GetSamWebClient()
        {
            WebClientUser userInformation = (WebClientUser)ConfigurationManager.GetSection("WebClientUser");
            ConfigurationProvider p = new ConfigurationProvider(userInformation);
            LSR.WebClient.SampleManager.RpcClient client
                = new LSR.WebClient.SampleManager.RpcClient(p);

            return client;
        }
Example #54
0
 /// <summary>
 /// Creates a LiveMatchClient that will call the LiveMatch service
 /// </summary>
 /// <returns></returns>
 internal static LSR.WebClient.LiveMatch.RpcClient GetLiveMatchClient()
 {
     var p = new ConfigurationProvider(UserInformation);
     var client = new LSR.WebClient.LiveMatch.RpcClient(p);
     return client;
 }