feat(cli): support passing a directory in --config-override.

fix #590
This commit is contained in:
genteure 2024-06-22 23:10:06 +08:00
parent 1f6f6216c5
commit 2ed57ec9ac

View File

@ -129,10 +129,19 @@ namespace BililiveRecorder.Cli
ConfigV3? config;
if (args.ConfigOverride is not null)
{
if (Directory.Exists(args.ConfigOverride))
{
var overrideFile = Path.Combine(args.ConfigOverride, "config.json");
logger.Information("Using config from {ConfigOverride}", overrideFile);
config = ConfigParser.LoadFromFile(overrideFile);
}
else
{
logger.Information("Using config from {ConfigOverride}", args.ConfigOverride);
config = ConfigParser.LoadFromFile(args.ConfigOverride);
}
}
else
{
config = ConfigParser.LoadFromDirectory(path);
@ -231,7 +240,8 @@ namespace BililiveRecorder.Cli
services.AddSingleton(new BasicAuthCredential(sharedArguments.HttpBasicUser ?? string.Empty, sharedArguments.HttpBasicPass ?? string.Empty));
}
if (sharedArguments.HttpOpenAccess || Environment.GetEnvironmentVariable("BREC_HTTP_OPEN_ACCESS") is not null){
if (sharedArguments.HttpOpenAccess || Environment.GetEnvironmentVariable("BREC_HTTP_OPEN_ACCESS") is not null)
{
services.AddSingleton(new DisableOpenAccessWarningConfig());
}
})