Removed frontend and moved out of sln into solely csproj style
This commit is contained in:
47
Startup.cs
Normal file
47
Startup.cs
Normal file
@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Hangfire;
|
||||
using Hangfire.PostgreSql;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace YTManager {
|
||||
public class Startup {
|
||||
public Startup(IConfiguration configuration) {
|
||||
Configuration = configuration;
|
||||
}
|
||||
|
||||
public IConfiguration Configuration { get; }
|
||||
|
||||
public static string DBStr {
|
||||
get {
|
||||
string s = Environment.GetEnvironmentVariable("POSTGRESQL_DBSTR");
|
||||
s = s ?? "Server=localhost;Port=32768;Database=postgres;User Id=postgres;";
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
public void ConfigureServices(IServiceCollection services) {
|
||||
Console.WriteLine("Using db string of: " + DBStr);
|
||||
services.AddMvc();
|
||||
services.AddDbContext<MediaDB>(x => x.UseNpgsql(DBStr));
|
||||
services.AddHangfire(x => x.UsePostgreSqlStorage(DBStr));
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
public void Configure(IApplicationBuilder app, IHostingEnvironment env) {
|
||||
if (env.IsDevelopment())
|
||||
app.UseDeveloperExceptionPage();
|
||||
|
||||
app.UseDefaultFiles();
|
||||
app.UseStaticFiles();
|
||||
app.UseCors(b => { b.AllowAnyOrigin(); b.AllowAnyMethod(); });
|
||||
app.UseMvc();
|
||||
app.UseHangfireServer();
|
||||
app.UseHangfireDashboard();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user