/// <summary>
        /// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        /// </summary>
        /// <param name="app"></param>
        /// <param name="configLogic"></param>
        /// <param name="streamRipperManager"></param>
        /// <param name="shoutcastDirectoryApi"></param>
        public void Configure(IApplicationBuilder app, IConfigLogic configLogic, IStreamRipperManager streamRipperManager, IShoutcastDirectoryApi shoutcastDirectoryApi)
        {
            configLogic.Refresh().Wait();

            streamRipperManager.Refresh().Wait();

            shoutcastDirectoryApi.Setup();

            app.UseMiniProfiler();

            app.UseCors("CorsPolicy");

            app.UseResponseCompression();

            if (_env.IsDevelopment())
            {
                app.UseDatabaseErrorPage();

                // Enable middleware to serve generated Swagger as a JSON endpoint.
                app.UseSwagger();

                // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
                // specifying the Swagger JSON endpoint.
                app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"));
            }

            // Not necessary for this workshop but useful when running behind kubernetes
            app.UseForwardedHeaders(new ForwardedHeadersOptions
            {
                // Read and use headers coming from reverse proxy: X-Forwarded-For X-Forwarded-Proto
                // This is particularly important so that HttpContent.Request.Scheme will be correct behind a SSL terminating proxy
                ForwardedHeaders = ForwardedHeaders.XForwardedFor |
                                   ForwardedHeaders.XForwardedProto
            });

            // Use wwwroot folder as default static path
            app.UseDefaultFiles()
            .UseStaticFiles()
            .UseCookiePolicy()
            .UseSession()
            .UseRouting()
            .UseCors("CorsPolicy")
            .UseAuthentication()
            .UseAuthorization()
            .UseEndpoints(endpoints =>
            {
                endpoints.MapDefaultControllerRoute();

                endpoints.MapHub <MessageHub>("/hub");
            });

            Console.WriteLine("Application Started!");
        }
Example #2
0
 public UserSetup(EntityDbContext dbContext, IStreamRipperManager streamRipperManager, ILogger <UserSetup> logger)
 {
     _dbContext           = dbContext;
     _streamRipperManager = streamRipperManager;
     _logger = logger;
 }
 /// <summary>
 /// Constructor dependency injection
 /// </summary>
 /// <param name="streamRipper"></param>
 /// <param name="userManager"></param>
 public StreamRipperManagerController(IStreamRipperManager streamRipper, UserManager <User> userManager)
 {
     _streamRipper = streamRipper;
     _userManager  = userManager;
 }