Beispiel #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>(),
                },
            });
        }
Beispiel #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();
        }
Beispiel #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>(),
                }
            });
        }
Beispiel #4
0
        public void Configure(
            IServiceProvider serviceProvider,
            IApplicationBuilder app,
            IHostingEnvironment env,
            IApplicationLifetime appLifetime,
            ILoggerFactory loggerFactory,
            IApiVersionDescriptionProvider apiVersionProvider,
            ApiDataDogToggle datadogToggle,
            ApiDebugDataDogToggle debugDataDogToggle,
            MsSqlStreamStore streamStore)
        {
            StartupHelpers.EnsureSqlStreamStoreSchema <Startup>(streamStore, loggerFactory);

            if (datadogToggle.FeatureEnabled)
            {
                if (debugDataDogToggle.FeatureEnabled)
                {
                    StartupHelpers.SetupSourceListener(serviceProvider.GetRequiredService <TraceSource>());
                }

                app.UseDataDogTracing(
                    serviceProvider.GetRequiredService <TraceSource>(),
                    _configuration["DataDog:ServiceName"],
                    pathToCheck => pathToCheck != "/");
            }

            app.UseDefaultForApi(new StartupOptions
            {
                ApplicationContainer = _applicationContainer,
                ServiceProvider      = serviceProvider,
                HostingEnvironment   = env,
                ApplicationLifetime  = appLifetime,
                LoggerFactory        = loggerFactory,
                Api =
                {
                    VersionProvider         = apiVersionProvider,
                    Info                    = groupName => $"Basisregisters Vlaanderen - Bank Account Number Registry API {groupName}",
                    CustomExceptionHandlers = new IExceptionHandler[]
                    {
                        new ValidationExceptionHandling(),
                    }
                },
                MiddlewareHooks =
                {
                    AfterMiddleware = x => x.UseMiddleware <AddNoCacheHeadersMiddleware>(),
                },
            });
        }
Beispiel #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
                }
            });
        }
Beispiel #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
                }
            });
        }
Beispiel #7
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();
        }
Beispiel #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 - Municipality Registry API {groupName}",
                    CSharpClientOptions =
                    {
                        ClassName = "MunicipalityRegistryCrabImport",
                        Namespace = "Be.Vlaanderen.Basisregisters"
                    },
                    TypeScriptClientOptions =
                    {
                        ClassName           = "MunicipalityRegistryCrabImport"
                    }
                },
                MiddlewareHooks =
                {
                    AfterMiddleware = x => x.UseMiddleware <AddNoCacheHeadersMiddleware>(),
                }
            })

            .UseIdempotencyDatabaseMigrations()
            .UseCrabImportMigrations();

            StartupHelpers.CheckDatabases(healthCheckService, DatabaseTag).GetAwaiter().GetResult();
        }