correctly passing cli arg connection string

This commit is contained in:
Andy Pack 2022-10-10 21:04:52 +01:00
parent a22907dc39
commit 61921ecc08
Signed by: sarsoo
GPG Key ID: A55BA3536A5E0ED7

View File

@ -29,16 +29,16 @@ namespace Selector.CLI
username.AddAlias("-u"); username.AddAlias("-u");
AddOption(username); AddOption(username);
Handler = CommandHandler.Create((string connectionString, string path, string username) => Execute(connectionString, path, username)); Handler = CommandHandler.Create((string connection, string path, string username) => Execute(connection, path, username));
} }
public static int Execute(string connectionString, string path, string username) public static int Execute(string connection, string path, string username)
{ {
var streams = new List<FileStream>(); var streams = new List<FileStream>();
try try
{ {
var context = new CommandContext().WithLogger().WithDb(connectionString).WithSpotify().WithRedis(); var context = new CommandContext().WithLogger().WithDb(connection).WithSpotify().WithRedis();
var logger = context.Logger.CreateLogger("Scrobble"); var logger = context.Logger.CreateLogger("Scrobble");
using var db = new ApplicationDbContext(context.DatabaseConfig.Options, context.Logger.CreateLogger<ApplicationDbContext>()); using var db = new ApplicationDbContext(context.DatabaseConfig.Options, context.Logger.CreateLogger<ApplicationDbContext>());