diff --git a/YTManager/Startup.cs b/YTManager/Startup.cs index fd20d9b..e586554 100644 --- a/YTManager/Startup.cs +++ b/YTManager/Startup.cs @@ -22,13 +22,15 @@ namespace YTManager { 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"; + // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(); - string constr = "Host=home.hak8or.com;Database=postgres;Username=postgres;Password=mysecretpassword"; - services.AddHangfire(x => x.UsePostgreSqlStorage(constr)); - services.AddDbContext(options => options.UseNpgsql(constr)); + services.AddHangfire(x => x.UsePostgreSqlStorage(dbstr)); + services.AddDbContext(options => options.UseNpgsql(dbstr)); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. diff --git a/YTManager/Tasks/FetchVideos.cs b/YTManager/Tasks/FetchVideos.cs index 34d2be6..1753039 100644 --- a/YTManager/Tasks/FetchVideos.cs +++ b/YTManager/Tasks/FetchVideos.cs @@ -22,8 +22,7 @@ namespace YTManager.Tasks // Get all the channels to update. var ops = new DbContextOptionsBuilder(); - string constr = "Host=home.hak8or.com;Database=postgres;Username=postgres;Password=mysecretpassword"; - ops.UseNpgsql(constr); + ops.UseNpgsql(YTManager.Startup.dbstr); using (var dbcontext = new MediaDB(ops.Options)) { var channels = dbcontext.Channels.ToList();