1 | using Microsoft.AspNet.Builder;
|
---|
2 | using Microsoft.AspNet.Hosting;
|
---|
3 | using Microsoft.Extensions.DependencyInjection;
|
---|
4 | using HeuristicLab.Clients.Hive.WebJobManager.Services;
|
---|
5 | using Microsoft.Extensions.Configuration;
|
---|
6 | using HeuristicLab.Common;
|
---|
7 | using HeuristicLab.Core;
|
---|
8 | using HeuristicLab.PluginInfrastructure;
|
---|
9 |
|
---|
10 |
|
---|
11 | namespace HeuristicLab.Clients.Hive.WebJobManager
|
---|
12 | {
|
---|
13 | public class Startup
|
---|
14 | {
|
---|
15 | public IHostingEnvironment hostingEnvironment {
|
---|
16 | get; set; }
|
---|
17 | public Startup(IHostingEnvironment hostingEnvironment)
|
---|
18 | {
|
---|
19 | var builder = new ConfigurationBuilder()
|
---|
20 | .AddJsonFile("conf.json")
|
---|
21 | .AddEnvironmentVariables();
|
---|
22 | var config = builder.Build();
|
---|
23 |
|
---|
24 | ApplicationManager.InitializeForWeb();
|
---|
25 |
|
---|
26 |
|
---|
27 | ContentManager.Initialize(new PersistenceContentManager());
|
---|
28 | //Console.WriteLine(""+ config.Get("configuration"));
|
---|
29 | this.hostingEnvironment = hostingEnvironment;
|
---|
30 | }
|
---|
31 | public void ConfigureServices(IServiceCollection services)
|
---|
32 | {
|
---|
33 |
|
---|
34 | services.AddMvc();
|
---|
35 | services.AddSingleton<ILoginViewModelService, LoginViewModelService>();
|
---|
36 | services.AddSingleton<IHiveServiceLocator, HiveServiceLocatorWeb>();
|
---|
37 | services.AddSignalR();
|
---|
38 | }
|
---|
39 |
|
---|
40 | public void Configure(IApplicationBuilder app)
|
---|
41 | {
|
---|
42 |
|
---|
43 | if (hostingEnvironment.IsDevelopment())
|
---|
44 | app.UseDeveloperExceptionPage();
|
---|
45 |
|
---|
46 | app.UseIISPlatformHandler();
|
---|
47 |
|
---|
48 | app.UseStaticFiles();
|
---|
49 | app.UseSignalR();
|
---|
50 | app.UseStatusCodePages();
|
---|
51 | app.UseMvcWithDefaultRoute();
|
---|
52 | }
|
---|
53 |
|
---|
54 |
|
---|
55 |
|
---|
56 | // Entry point for the application.
|
---|
57 | public static void Main(string[] args) => WebApplication.Run<Startup>(args);
|
---|
58 | }
|
---|
59 | }
|
---|