Pulled connection string out to appsettings.json file.

This commit is contained in:
Daniel Wathen
2022-12-09 15:04:08 -07:00
parent 43957fe66d
commit 0b28c39b16
4 changed files with 11 additions and 3 deletions

View File

@ -8,7 +8,13 @@ namespace ReportingServices.Dependency_Injections
public class ScrapeDatabaseRepository : IScrapeDatabaseRepository public class ScrapeDatabaseRepository : IScrapeDatabaseRepository
{ {
private SqlConnection _connection; private SqlConnection _connection;
private string _connectionString = "Server=Messv01ec.ec.local\\PROD1,53959;Database=LSL2SQL;User Id=srpadmin;Password=0okm9ijn;TrustServerCertificate=true"; private string _connectionString;
public ScrapeDatabaseRepository()
{
IConfiguration configuration = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
_connectionString = configuration.GetConnectionString("DefaultConnection");
}
public void OpenConnection() public void OpenConnection()
{ {

View File

@ -1,4 +1,3 @@
using Microsoft.AspNetCore.Builder;
using ReportingServices.Dependency_Injections; using ReportingServices.Dependency_Injections;
using Serilog; using Serilog;

View File

@ -5,6 +5,9 @@
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning"
} }
}, },
"ConnectionStrings": {
"DefaultConnection": "Server=Messv01ec.ec.local\\PROD1,53959;Database=LSL2SQL;User Id=srpadmin;Password=0okm9ijn;TrustServerCertificate=true"
},
"AllowedHosts": "*", "AllowedHosts": "*",
"Serilog": { "Serilog": {
"Using": [ "Using": [

File diff suppressed because one or more lines are too long