moved connection string to the app config

This commit is contained in:
2019-01-25 23:04:47 +01:00
parent 6630496029
commit 8d04684c95
5 changed files with 9 additions and 6 deletions

View File

@@ -9,5 +9,7 @@ namespace Tv7Playlist.Core
string UdpxyUrl { get; set; } string UdpxyUrl { get; set; }
string DownloadFileName { get; set; } string DownloadFileName { get; set; }
string SqLiteConnectionString { get; set; }
} }
} }

View File

@@ -3,9 +3,8 @@ using Tv7Playlist.Core;
namespace Tv7Playlist namespace Tv7Playlist
{ {
public class AppConfig : IAppConfig internal class AppConfig : IAppConfig
{ {
private string _tv7Url; private string _tv7Url;
private string _udpxyUrl; private string _udpxyUrl;
@@ -34,5 +33,7 @@ namespace Tv7Playlist
} }
public string DownloadFileName { get; set; } public string DownloadFileName { get; set; }
public string SqLiteConnectionString { get; set; }
} }
} }

View File

@@ -112,9 +112,7 @@ namespace Tv7Playlist
private static void ConfigureDatabase(IServiceCollection services, IAppConfig appConfig) private static void ConfigureDatabase(IServiceCollection services, IAppConfig appConfig)
{ {
//TODO: Move to settings to make it configurable within docker. services.AddDbContext<PlaylistContext>(options => options.UseSqlite(appConfig.SqLiteConnectionString));
var connection = "Data Source=playlist.db";
services.AddDbContext<PlaylistContext>(options => options.UseSqlite(connection));
} }
private void LogConfiguration(IAppConfig appConfig) private void LogConfiguration(IAppConfig appConfig)

View File

@@ -5,5 +5,6 @@
"System": "Information", "System": "Information",
"Microsoft": "Information" "Microsoft": "Information"
} }
} },
"SqLiteConnectionString": "Data Source=../playlist.db"
} }

View File

@@ -8,6 +8,7 @@
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"SourceType": "M3U", "SourceType": "M3U",
"SqLiteConnectionString": "Data Source=/data/playlist.db",
"TV7Url": "https://api.init7.net/tvchannels.m3u", "TV7Url": "https://api.init7.net/tvchannels.m3u",
"UdpxyUrl": "http://192.168.15.2:4022/udp", "UdpxyUrl": "http://192.168.15.2:4022/udp",
"DownloadFileName": "PlaylistTV7udpxy.m3u" "DownloadFileName": "PlaylistTV7udpxy.m3u"