feat(cli): setting http basic auth with env vars

close #424
This commit is contained in:
genteure 2023-06-17 23:24:36 +08:00
parent 0e7e2d03c9
commit d2d12fbac9

View File

@ -215,6 +215,9 @@ namespace BililiveRecorder.Cli
services.AddSingleton(new BililiveRecorderFileExplorerSettings(sharedArguments.EnableFileBrowser));
sharedArguments.HttpBasicUser ??= Environment.GetEnvironmentVariable("BREC_HTTP_BASIC_USER");
sharedArguments.HttpBasicPass ??= Environment.GetEnvironmentVariable("BREC_HTTP_BASIC_PASS");
if (sharedArguments.HttpBasicUser is not null || sharedArguments.HttpBasicPass is not null)
{
services.AddSingleton(new BasicAuthCredential(sharedArguments.HttpBasicUser ?? string.Empty, sharedArguments.HttpBasicPass ?? string.Empty));