-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathStartup.cs
More file actions
48 lines (39 loc) · 1.53 KB
/
Copy pathStartup.cs
File metadata and controls
48 lines (39 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
namespace Website
{
using System.Globalization;
using System.Threading.Tasks;
using Domain;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Olive;
using Olive.Entities.Data;
using Olive.Hangfire;
using Olive.Mvc.Testing;
public class Startup : Olive.Mvc.Startup
{
public Startup(IHostingEnvironment env, IConfiguration config) : base(env, config) { }
protected override CultureInfo GetRequestCulture() => new CultureInfo("en-GB");
public override void ConfigureServices(IServiceCollection services)
{
base.ConfigureServices(services);
services.AddDatabaseLogger();
AuthenticationBuilder.AddSocialAuth();
services.AddScheduledTasks();
}
public override void Configure(IApplicationBuilder app)
{
if (Environment.IsDevelopment()) app.UseWebTest(config => config.AddTasks());
base.Configure(app);
if (Config.Get<bool>("Automated.Tasks:Enabled"))
app.UseScheduledTasks(TaskManager.Run);
}
public override async Task OnStartUpAsync(IApplicationBuilder app)
{
if (Environment.IsDevelopment())
await app.InitializeTempDatabase<SqlServerManager>(() => ReferenceData.Create());
// Add any other initialization logic that needs the database to be ready here.
}
}
}