Ejemplo n.º 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            var lifetimeScope = app.ApplicationServices.GetAutofacRoot();

            foreach (var componentName in AutofacConfig.GetComponentsToRun(Configuration))
            {
                StartComponent(lifetimeScope, AutofacConfig.ModuleTypeDictionary[componentName]);
            }
            lifetimeScope.Resolve <CaPMSystem>().Start();
            Controllers.IngestEventsHub.Start(lifetimeScope.Resolve <IChannelProvider>(), lifetimeScope.Resolve <IComponentChannelIdentifierRepository>(), lifetimeScope.Resolve <IHubContext <IngestEventsHub> >());
            Controllers.PreservationSystemHub.Initialize(lifetimeScope.Resolve <IHubContext <PreservationSystemHub> >());

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHttpsRedirection();
            }

            var publicFilesFileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "public"));

            app.UseDefaultFiles(new DefaultFilesOptions()
            {
                DefaultFileNames = new List <string> {
                    "index.html"
                },
                RequestPath  = null,
                FileProvider = publicFilesFileProvider
            });

            app.UseStaticFiles(new StaticFileOptions()
            {
                RequestPath  = null,
                FileProvider = publicFilesFileProvider
            });

            app.UseRouting();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                endpoints.MapHub <IngestEventsHub>("/hubs/ingest");
                endpoints.MapHub <PreservationSystemHub>("/hubs/dps");
            });
        }
Ejemplo n.º 2
0
 public void ConfigureContainer(ContainerBuilder builder)
 {
     AutofacConfig.BootstrapIoCContainer(builder, Configuration);
 }