// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add your AppInsights ID here to make it globally available // services.AddApplicationInsightsTelemetry("465f47b3-8d7a-46ee-a81e-e51182c12296"); services.Configure <Secrets.ConnectionStrings>(Configuration.GetSection("ConnectionStrings")); services.Configure <Secrets.Login>(Configuration.GetSection("ConnectionStrings")); // project's DI services.AddSingleton <MyEmail>(); services.AddNodeServices(); Bootstrap.Configure(services, Configuration); CookiesAuth.Configure(services, Configuration, HostingEnvironment.IsDevelopment()); services.AddMvc() .SetCompatibilityVersion(CompatibilityVersion.Version_2_2) .AddJsonOptions(options => { options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore; options.SerializerSettings.DefaultValueHandling = DefaultValueHandling.Ignore; }); services.AddResponseCompression(options => { options.MimeTypes = new[] { // Default "text/plain", // "image/png", "image/jpg", "image/jpeg", "image/jp2", "text/css", "application/javascript", "text/html", "application/xml", "text/xml", "application/json", "text/json", "font", "font/woff2", "font/woff", "image/x-icon", // Custom "image/svg+xml", "script" }; options.EnableForHttps = true; }); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add your AppInsights ID here to make it globally available // services.AddApplicationInsightsTelemetry("9e5cc6db-d8d8-49c5-aa18-d60b4d06196b"); // string hostCors = Configuration.GetSection("ConnectionStrings")["Cors"]; services.AddCors(options => { options.AddPolicy(RicardoGaefkeCors, builder => { builder .WithOrigins( "https://localhost:5050", "https://localhost:5055", "https://localhost:5060", "https://www.ricardogaefke.com", "https://login.ricardogaefke.com", "https://ci.ricardogaefke.com" ) .SetIsOriginAllowedToAllowWildcardSubdomains() .AllowAnyHeader() .AllowAnyMethod() .AllowCredentials(); } ); }); // project's DI services.AddSingleton <MyEmail>(); Bootstrap.Configure(services, Configuration); CookiesAuth.Configure(services, Configuration, HostingEnvironment.IsDevelopment()); services.AddControllers(); services.AddSwaggerDocument(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add your AppInsights ID here to make it globally available // services.AddApplicationInsightsTelemetry("b67197a1-4fac-4177-a4e7-c42f808c7abd"); services.AddCors(options => { options.AddDefaultPolicy(builder => { if (HostingEnvironment.IsDevelopment()) { builder .WithOrigins( "https://localhost:5050", "https://localhost:5055", "https://localhost:5060", "https://localhost:5065" ) .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials() ; } else { builder .WithOrigins( "https://*.ricardogaefke.com" ).SetIsOriginAllowedToAllowWildcardSubdomains() .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials() ; } }); }); Bootstrap.Configure(services, Configuration); services.AddNodeServices(); CookiesAuth.Configure(services, Configuration, HostingEnvironment.IsDevelopment()); services.Configure <Secrets.ConnectionStrings>(Configuration.GetSection("ConnectionStrings")); services.AddMvc(config => { var policy = new AuthorizationPolicyBuilder() .RequireAuthenticatedUser() .Build() ; config.Filters.Add(new AuthorizeFilter(policy)); }) .SetCompatibilityVersion(CompatibilityVersion.Version_2_2) .AddJsonOptions(options => { options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore; options.SerializerSettings.DefaultValueHandling = DefaultValueHandling.Ignore; }) ; services.AddResponseCompression(options => { options.MimeTypes = new[] { // Default "text/plain", // "image/png", "image/jpg", "image/jpeg", "image/jp2", "text/css", "application/javascript", "text/html", "application/xml", "text/xml", "application/json", "text/json", "font", "font/woff2", "font/woff", "image/x-icon", // Custom "image/svg+xml", "script" }; options.EnableForHttps = true; }); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add your AppInsights ID here to make it globally available // services.AddApplicationInsightsTelemetry("ad26124a-c2fe-415a-859a-1852f7d2c75e"); services.AddCors(options => { options.AddPolicy(RicardoGaefkeCors, builder => { builder .WithOrigins( "https://localhost:5050", "https://localhost:5055", "https://localhost:5060", "https://www.ricardogaefke.com", "https://login.ricardogaefke.com", "https://ci.ricardogaefke.com" ) .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials() ; } ); }); // project's DI services.AddSingleton <MyEmail>(); services.AddNodeServices(); Bootstrap.Configure(services, Configuration); CookiesAuth.Configure(services, Configuration, HostingEnvironment.IsDevelopment()); services.Configure <Secrets.ConnectionStrings>(Configuration.GetSection("ConnectionStrings")); services.AddMvc() .SetCompatibilityVersion(CompatibilityVersion.Version_2_2) .AddJsonOptions(options => { options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore; options.SerializerSettings.DefaultValueHandling = DefaultValueHandling.Ignore; }) ; services.AddResponseCompression(options => { options.MimeTypes = new[] { // Default "text/plain", // "image/png", "image/jpg", "image/jpeg", "image/jp2", "text/css", "application/javascript", "text/html", "application/xml", "text/xml", "application/json", "text/json", "font", "font/woff2", "font/woff", "image/x-icon", // Custom "image/svg+xml", "script" }; options.EnableForHttps = true; }); }