49 lines
1.7 KiB
C#
49 lines
1.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Logging;
|
|
using Microsoft.Extensions.Options;
|
|
using Hangfire;
|
|
using Hangfire.PostgreSql;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace YTManager {
|
|
public class Startup {
|
|
public Startup(IConfiguration configuration) {
|
|
Configuration = configuration;
|
|
}
|
|
|
|
public IConfiguration Configuration { get; }
|
|
|
|
// String used for connecting to the database server.
|
|
public static string dbstr { get; } = "Host=192.168.1.130;Database=postgres;Username=postgres;Password=pass";
|
|
|
|
// ID for periodic job to update all channels.
|
|
public static string periodicupdatejobID { get; } = "2013066213";
|
|
|
|
// This method gets called by the runtime. Use this method to add services to the container.
|
|
public void ConfigureServices(IServiceCollection services) {
|
|
services.AddMvc();
|
|
services.AddHangfire(x => x.UsePostgreSqlStorage(dbstr));
|
|
services.AddDbContext<MediaDB>(options => options.UseNpgsql(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.UseMvc();
|
|
app.UseHangfireServer();
|
|
app.UseHangfireDashboard();
|
|
}
|
|
}
|
|
}
|