Exemple #1
0
        public void Configure(
            IServiceProvider serviceProvider,
            IApplicationBuilder app,
            IWebHostEnvironment env,
            IHostApplicationLifetime appLifetime,
            ILoggerFactory loggerFactory,
            IApiVersionDescriptionProvider apiVersionProvider,
            MsSqlStreamStore streamStore,
            ApiDataDogToggle datadogToggle,
            ApiDebugDataDogToggle debugDataDogToggle,
            HealthCheckService healthCheckService)
        {
            StartupHelpers.CheckDatabases(healthCheckService, DatabaseTag).GetAwaiter().GetResult();
            StartupHelpers.EnsureSqlStreamStoreSchema <Startup>(streamStore, loggerFactory);

            app
            .UseDatadog <Startup>(
                serviceProvider,
                loggerFactory,
                datadogToggle,
                debugDataDogToggle,
                _configuration["DataDog:ServiceName"])

            .UseDefaultForApi(new StartupUseOptions
            {
                Common =
                {
                    ApplicationContainer = _applicationContainer,
                    ServiceProvider      = serviceProvider,
                    HostingEnvironment   = env,
                    ApplicationLifetime  = appLifetime,
                    LoggerFactory        = loggerFactory,
                },
                Api =
                {
                    VersionProvider         = apiVersionProvider,
                    Info                    = groupName => $"exira.com - Dns API {groupName}",
                    CustomExceptionHandlers = new IExceptionHandler[]
                    {
                        new DomainExceptionHandler(),
                        new Exceptions.ApiExceptionHandler(),
                        new AggregateNotFoundExceptionHandling(),
                        new WrongExpectedVersionExceptionHandling(),
                        new InvalidTopLevelDomainExceptionHandling(),
                        new InvalidRecordTypeExceptionHandling(),
                        new InvalidServiceTypeExceptionHandling(),
                        new ValidationExceptionHandler(),
                    }
                },
                Server =
                {
                    PoweredByName = "exira.com",
                    ServerName    = "exira.com"
                },
                MiddlewareHooks =
                {
                    AfterMiddleware = x => x.UseMiddleware <AddNoCacheHeadersMiddleware>(),
                },
            });
        }
Exemple #2
0
        public void Configure(
            IServiceProvider serviceProvider,
            IApplicationBuilder app,
            IHostingEnvironment env,
            IApplicationLifetime appLifetime,
            ILoggerFactory loggerFactory,
            IApiVersionDescriptionProvider apiVersionProvider,
            ApiDataDogToggle datadogToggle,
            ApiDebugDataDogToggle debugDataDogToggle,
            MsSqlStreamStore streamStore,
            HealthCheckService healthCheckService)
        {
            StartupHelpers.CheckDatabases(healthCheckService, DatabaseTag).GetAwaiter().GetResult();
            StartupHelpers.EnsureSqlStreamStoreSchema <Startup>(streamStore, loggerFactory);

            app
            .UseDatadog <Startup>(
                serviceProvider,
                loggerFactory,
                datadogToggle,
                debugDataDogToggle,
                _configuration["DataDog:ServiceName"])

            .UseDefaultForApi(new StartupUseOptions
            {
                Common =
                {
                    ApplicationContainer = _applicationContainer,
                    ServiceProvider      = serviceProvider,
                    HostingEnvironment   = env,
                    ApplicationLifetime  = appLifetime,
                    LoggerFactory        = loggerFactory,
                },
                Api =
                {
                    VersionProvider = apiVersionProvider,
                    Info            = groupName => $"exira.com - Account Projector API {groupName}",
                },
                Server =
                {
                    PoweredByName = "exira.com",
                    ServerName    = "exira.com"
                },
                MiddlewareHooks =
                {
                    AfterMiddleware = x => x.UseMiddleware <AddNoCacheHeadersMiddleware>(),
                }
            });

            var projectionsManager = serviceProvider.GetRequiredService <IConnectedProjectionsManager>();

            projectionsManager.Start();
        }
Exemple #3
0
        public void Configure(
            IServiceProvider serviceProvider,
            IApplicationBuilder app,
            IHostingEnvironment env,
            IApplicationLifetime appLifetime,
            ILoggerFactory loggerFactory,
            IApiVersionDescriptionProvider apiVersionProvider,
            MsSqlStreamStore streamStore,
            ApiDataDogToggle datadogToggle,
            ApiDebugDataDogToggle debugDataDogToggle,
            HealthCheckService healthCheckService)
        {
            StartupHelpers.CheckDatabases(healthCheckService, DatabaseTag).GetAwaiter().GetResult();
            StartupHelpers.EnsureSqlStreamStoreSchema <Startup>(streamStore, loggerFactory);

            app
            .UseDatadog <Startup>(
                serviceProvider,
                loggerFactory,
                datadogToggle,
                debugDataDogToggle,
                _configuration["DataDog:ServiceName"])

            .UseDefaultForApi(new StartupUseOptions
            {
                Common =
                {
                    ApplicationContainer = _applicationContainer,
                    ServiceProvider      = serviceProvider,
                    HostingEnvironment   = env,
                    ApplicationLifetime  = appLifetime,
                    LoggerFactory        = loggerFactory
                },
                Api =
                {
                    VersionProvider         = apiVersionProvider,
                    Info                    = groupName => $"Basisregisters Vlaanderen - Dienstverleningsregister API {groupName}",
                    CustomExceptionHandlers = new []
                    {
                        new GetOrganisationFailedHandler()
                    }
                },
                MiddlewareHooks =
                {
                    AfterApiExceptionHandler = x => x.UseAuthentication(),
                    AfterMiddleware          = x => x.UseMiddleware <AddNoCacheHeadersMiddleware>(),
                }
            });
        }
        public void Configure(
            IServiceProvider serviceProvider,
            IApplicationBuilder app,
            IWebHostEnvironment env,
            IHostApplicationLifetime appLifetime,
            ILoggerFactory loggerFactory,
            IApiVersionDescriptionProvider apiVersionProvider,
            ApiDataDogToggle datadogToggle,
            ApiDebugDataDogToggle debugDataDogToggle,
            HealthCheckService healthCheckService)
        {
            StartupHelpers.CheckDatabases(healthCheckService, DatabaseTag).GetAwaiter().GetResult();

            app
            .UseDataDog <Startup>(new DataDogOptions
            {
                Common =
                {
                    ServiceProvider = serviceProvider,
                    LoggerFactory   = loggerFactory
                },
                Toggles =
                {
                    Enable = datadogToggle,
                    Debug  = debugDataDogToggle
                },
                Tracing =
                {
                    ServiceName = _configuration["DataDog:ServiceName"],
                }
            })

            .UseDefaultForApi(new StartupUseOptions
            {
                Common =
                {
                    ApplicationContainer = _applicationContainer,
                    ServiceProvider      = serviceProvider,
                    HostingEnvironment   = env,
                    ApplicationLifetime  = appLifetime,
                    LoggerFactory        = loggerFactory
                },
                Api =
                {
                    VersionProvider     = apiVersionProvider,
                    Info                = groupName => $"Basisregisters Vlaanderen - Municipality Registry API {groupName}",
                    CSharpClientOptions =
                    {
                        ClassName = "MunicipalityRegistryProjector",
                        Namespace = "Be.Vlaanderen.Basisregisters"
                    },
                    TypeScriptClientOptions =
                    {
                        ClassName           = "MunicipalityRegistryProjector"
                    }
                },
                MiddlewareHooks =
                {
                    AfterMiddleware = x => x.UseMiddleware <AddNoCacheHeadersMiddleware>(),
                }
            })

            .UseProjectionsManager(new ProjectionsManagerOptions
            {
                Common =
                {
                    ServiceProvider     = serviceProvider,
                    ApplicationLifetime = appLifetime
                }
            });
        }
Exemple #5
0
        public void Configure(
            IServiceProvider serviceProvider,
            IApplicationBuilder app,
            IWebHostEnvironment env,
            IHostApplicationLifetime appLifetime,
            ILoggerFactory loggerFactory,
            IApiVersionDescriptionProvider apiVersionProvider,
            ApiDataDogToggle datadogToggle,
            ApiDebugDataDogToggle debugDataDogToggle,
            MsSqlStreamStore streamStore,
            HealthCheckService healthCheckService)
        {
            StartupHelpers.CheckDatabases(healthCheckService, DatabaseTag).GetAwaiter().GetResult();
            StartupHelpers.EnsureSqlStreamStoreSchema <Startup>(streamStore, loggerFactory);

            app
            .UseDataDog <Startup>(new DataDogOptions
            {
                Common =
                {
                    ServiceProvider = serviceProvider,
                    LoggerFactory   = loggerFactory
                },
                Toggles =
                {
                    Enable = datadogToggle,
                    Debug  = debugDataDogToggle
                },
                Tracing =
                {
                    ServiceName = _configuration["DataDog:ServiceName"],
                }
            })

            .UseDefaultForApi(new StartupUseOptions
            {
                Common =
                {
                    ApplicationContainer = _applicationContainer,
                    ServiceProvider      = serviceProvider,
                    HostingEnvironment   = env,
                    ApplicationLifetime  = appLifetime,
                    LoggerFactory        = loggerFactory,
                },
                Api =
                {
                    VersionProvider     = apiVersionProvider,
                    Info                = groupName => $"Example Registry Projector API {groupName}",
                    CSharpClientOptions =
                    {
                        ClassName = "ExampleRegistry",
                        Namespace = "ExampleRegistry.Projector"
                    },
                    TypeScriptClientOptions =
                    {
                        ClassName           = "ExampleRegistry"
                    },
                },
                Server =
                {
                    PoweredByName = "Vlaamse overheid - Basisregisters Vlaanderen",
                    ServerName    = "agentschap Informatie Vlaanderen"
                },
                MiddlewareHooks =
                {
                    AfterMiddleware = x => x.UseMiddleware <AddNoCacheHeadersMiddleware>(),
                }
            })

            .UseProjectionsManager(new ProjectionsManagerOptions
            {
                Common =
                {
                    ServiceProvider     = serviceProvider,
                    ApplicationLifetime = appLifetime
                }
            });
        }
Exemple #6
0
        public void Configure(
            IServiceProvider serviceProvider,
            IApplicationBuilder app,
            IWebHostEnvironment env,
            IHostApplicationLifetime appLifetime,
            ILoggerFactory loggerFactory,
            IApiVersionDescriptionProvider apiVersionProvider,
            MsSqlStreamStore streamStore,
            ApiDataDogToggle datadogToggle,
            ApiDebugDataDogToggle debugDataDogToggle,
            HealthCheckService healthCheckService)
        {
            StartupHelpers.CheckDatabases(healthCheckService, DatabaseTag).GetAwaiter().GetResult();
            StartupHelpers.EnsureSqlStreamStoreSchema <Startup>(streamStore, loggerFactory);

            app
            .UseDataDog <Startup>(new DataDogOptions
            {
                Common =
                {
                    ServiceProvider = serviceProvider,
                    LoggerFactory   = loggerFactory
                },
                Toggles =
                {
                    Enable = datadogToggle,
                    Debug  = debugDataDogToggle
                },
                Tracing =
                {
                    ServiceName = _configuration["DataDog:ServiceName"],
                }
            })

            .UseDefaultForApi(new StartupUseOptions
            {
                Common =
                {
                    ApplicationContainer = _applicationContainer,
                    ServiceProvider      = serviceProvider,
                    HostingEnvironment   = env,
                    ApplicationLifetime  = appLifetime,
                    LoggerFactory        = loggerFactory,
                },
                Api =
                {
                    VersionProvider         = apiVersionProvider,
                    Info                    = groupName => $"exira.com - Dns Projector API {groupName}",
                    CustomExceptionHandlers = new IExceptionHandler[]
                    {
                        new ValidationExceptionHandler(),
                    }
                },
                Server =
                {
                    PoweredByName = "exira.com",
                    ServerName    = "exira.com"
                },
                MiddlewareHooks =
                {
                    AfterMiddleware = x => x.UseMiddleware <AddNoCacheHeadersMiddleware>(),
                }
            })

            .UseProjectionsManager(new ProjectionsManagerOptions
            {
                Common =
                {
                    ServiceProvider     = serviceProvider,
                    ApplicationLifetime = appLifetime
                }
            });
        }
Exemple #7
0
        public void Configure(
            IServiceProvider serviceProvider,
            IApplicationBuilder app,
            IWebHostEnvironment env,
            IHostApplicationLifetime appLifetime,
            ILoggerFactory loggerFactory,
            IApiVersionDescriptionProvider apiVersionProvider,
            ApiDataDogToggle datadogToggle,
            ApiDebugDataDogToggle debugDataDogToggle,
            HealthCheckService healthCheckService)
        {
            StartupHelpers
            .CheckDatabases(healthCheckService, DatabaseTag)
            .GetAwaiter()
            .GetResult();

            app
            .UseDataDog <Startup>(new DataDogOptions
            {
                Common =
                {
                    ServiceProvider = serviceProvider,
                    LoggerFactory   = loggerFactory
                },
                Toggles =
                {
                    Enable = datadogToggle,
                    Debug  = debugDataDogToggle
                },
                Tracing =
                {
                    ServiceName = _configuration["DataDog:ServiceName"],
                }
            })

            .UseDefaultForApi(new StartupUseOptions
            {
                Common =
                {
                    ApplicationContainer = _applicationContainer,
                    ServiceProvider      = serviceProvider,
                    HostingEnvironment   = env,
                    ApplicationLifetime  = appLifetime,
                    LoggerFactory        = loggerFactory,
                },
                Api =
                {
                    VersionProvider     = apiVersionProvider,
                    Info                = groupName => $"Basisregisters Vlaanderen - Address Registry API {groupName}",
                    CSharpClientOptions =
                    {
                        ClassName = "AddressRegistry",
                        Namespace = "Be.Vlaanderen.Basisregisters"
                    },
                    TypeScriptClientOptions =
                    {
                        ClassName           = "AddressRegistry"
                    },
                    CustomExceptionHandlers = new IExceptionHandler[]
                    {
                        new CrabClientValidationExceptionHandler()
                    }
                },
                Server =
                {
                    PoweredByName = "Vlaamse overheid - Basisregisters Vlaanderen",
                    ServerName    = "agentschap Informatie Vlaanderen"
                }
            });
        }
Exemple #8
0
        public void Configure(
            IServiceProvider serviceProvider,
            IApplicationBuilder app,
            IWebHostEnvironment env,
            IHostApplicationLifetime appLifetime,
            ILoggerFactory loggerFactory,
            IApiVersionDescriptionProvider apiVersionProvider,
            MsSqlStreamStore streamStore,
            ApiDataDogToggle datadogToggle,
            ApiDebugDataDogToggle debugDataDogToggle,
            HealthCheckService healthCheckService)
        {
            StartupHelpers.EnsureSqlStreamStoreSchema <Startup>(streamStore, loggerFactory);

            app
            .UseDataDog <Startup>(new DataDogOptions
            {
                Common =
                {
                    ServiceProvider = serviceProvider,
                    LoggerFactory   = loggerFactory
                },
                Toggles =
                {
                    Enable = datadogToggle,
                    Debug  = debugDataDogToggle
                },
                Tracing =
                {
                    ServiceName = _configuration["DataDog:ServiceName"],
                }
            })

            .UseDefaultForApi(new StartupUseOptions
            {
                Common =
                {
                    ApplicationContainer = _applicationContainer,
                    ServiceProvider      = serviceProvider,
                    HostingEnvironment   = env,
                    ApplicationLifetime  = appLifetime,
                    LoggerFactory        = loggerFactory,
                },
                Api =
                {
                    VersionProvider     = apiVersionProvider,
                    Info                = groupName => $"Basisregisters Vlaanderen - Address Registry API {groupName}",
                    CSharpClientOptions =
                    {
                        ClassName = "AddressRegistryCrabImport",
                        Namespace = "Be.Vlaanderen.Basisregisters"
                    },
                    TypeScriptClientOptions =
                    {
                        ClassName           = "AddressRegistryCrabImport"
                    }
                },
                Server =
                {
                    PoweredByName = "Vlaamse overheid - Basisregisters Vlaanderen",
                    ServerName    = "agentschap Informatie Vlaanderen"
                },
                MiddlewareHooks =
                {
                    AfterMiddleware = x => x.UseMiddleware <AddNoCacheHeadersMiddleware>(),
                }
            });

            app.UseIdempotencyDatabaseMigrations()
            .UseCrabImportMigrations();

            MigrationsHelper.Run(
                _configuration.GetConnectionString("Sequences"),
                serviceProvider.GetService <ILoggerFactory>());

            new LegacyContextMigrationFactory()
            .CreateMigrator(_configuration, _loggerFactory)
            .MigrateAsync(new CancellationToken())
            .GetAwaiter()
            .GetResult();

            StartupHelpers.CheckDatabases(healthCheckService, DatabaseTag).GetAwaiter().GetResult();
        }
Exemple #9
0
        public void Configure(
            IServiceProvider serviceProvider,
            IApplicationBuilder app,
            IWebHostEnvironment env,
            IHostApplicationLifetime appLifetime,
            ILoggerFactory loggerFactory,
            IApiVersionDescriptionProvider apiVersionProvider,
            ApiDataDogToggle datadogToggle,
            ApiDebugDataDogToggle debugDataDogToggle,
            HealthCheckService healthCheckService)
        {
            StartupHelpers.CheckDatabases(healthCheckService, DatabaseTag).GetAwaiter().GetResult();

            app
            .UseDataDog <Startup>(new DataDogOptions
            {
                Common =
                {
                    ServiceProvider = serviceProvider,
                    LoggerFactory   = loggerFactory
                },
                Toggles =
                {
                    Enable = datadogToggle,
                    Debug  = debugDataDogToggle
                },
                Tracing =
                {
                    ServiceName = _configuration["DataDog:ServiceName"],
                }
            })

            .UseDefaultForApi(new StartupUseOptions
            {
                Common =
                {
                    ApplicationContainer = _applicationContainer,
                    ServiceProvider      = serviceProvider,
                    HostingEnvironment   = env,
                    ApplicationLifetime  = appLifetime,
                    LoggerFactory        = loggerFactory,
                },
                Api =
                {
                    VersionProvider     = apiVersionProvider,
                    Info                = groupName => $"Basisregisters.Vlaanderen - Parcel Information Registry API {groupName}",
                    CSharpClientOptions =
                    {
                        ClassName = "ParcelRegistryProjector",
                        Namespace = "Be.Vlaanderen.Basisregisters"
                    },
                    TypeScriptClientOptions = { ClassName = "ParcelRegistryProjector" }
                },
                Server =
                {
                    PoweredByName = "Vlaamse overheid - Basisregisters Vlaanderen",
                    ServerName    = "Digitaal Vlaanderen"
                },
                MiddlewareHooks = { AfterMiddleware = x => x.UseMiddleware <AddNoCacheHeadersMiddleware>() }
            });

            appLifetime.ApplicationStopping.Register(() => _projectionsCancellationTokenSource.Cancel());
            appLifetime.ApplicationStarted.Register(() =>
            {
                var projectionsManager = _applicationContainer.Resolve <IConnectedProjectionsManager>();
                projectionsManager.Resume(_projectionsCancellationTokenSource.Token);
            });
        }