Authorize configured accounts during offline startup
This commit is contained in:
@@ -52,7 +52,7 @@ public sealed class RemoteAgentHostedService(
|
||||
string? registeredActiveAccountId = null;
|
||||
bool? registeredActiveAccountVerified = null;
|
||||
long registeredReportingConfigVersion = -1;
|
||||
ReportingConfig? activeReporting = null;
|
||||
ReportingConfig? activeReporting = ConnectionAuthorizedReporting(options.Reporting, null);
|
||||
var retry = RetryDelay;
|
||||
while (!stoppingToken.IsCancellationRequested)
|
||||
{
|
||||
@@ -738,13 +738,16 @@ public sealed class RemoteAgentHostedService(
|
||||
}
|
||||
}
|
||||
|
||||
private static ReportingConfig ConnectionAuthorizedReporting(ReportingConfig configured, BackendSnapshot snapshot)
|
||||
private static ReportingConfig ConnectionAuthorizedReporting(ReportingConfig configured, BackendSnapshot? snapshot)
|
||||
{
|
||||
var accounts = snapshot.Accounts
|
||||
.Where(identity => identity.Verified)
|
||||
.Select(identity => new AccountReportingConfig
|
||||
var accountIds = snapshot is not null
|
||||
? snapshot.Accounts.Where(identity => identity.Verified).Select(identity => identity.AccountId)
|
||||
: configured.Accounts.Where(account => account.Enabled).Select(account => account.AccountId);
|
||||
var accounts = accountIds
|
||||
.Distinct(StringComparer.Ordinal)
|
||||
.Select(accountId => new AccountReportingConfig
|
||||
{
|
||||
AccountId = identity.AccountId,
|
||||
AccountId = accountId,
|
||||
Enabled = true,
|
||||
AllowedChats =
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user