resolveProviderQueueAtBoot function

ProviderQueueResolution resolveProviderQueueAtBoot({
  1. required String projectDir,
  2. required String homeDir,
  3. Map<String, String>? env,
})

Resolves the FA_PROVIDERS_QUEUE scope chain at boot: the env var, the project .fah/config.yaml providersQueue: section, the user ~/.fah/config.yaml one. Absent files/sections are not present; a present-but-invalid section throws ConfigException naming the file (strict, like every other config section).

Implementation

ProviderQueueResolution resolveProviderQueueAtBoot({
  required String projectDir,
  required String homeDir,
  Map<String, String>? env,
}) {
  final environment = env ?? Platform.environment;
  final envText = environment['FA_PROVIDERS_QUEUE'];
  final inputs = <ProviderQueueScopeInput>[
    ProviderQueueScopeInput(
      scope: ProviderQueueScope.env,
      isPresent: envText != null && envText.trim().isNotEmpty,
      parse: envText == null || envText.trim().isEmpty
          ? null
          : parseProviderQueueEnv(envText),
    ),
    ...[
      for (final (scope, path) in [
        (ProviderQueueScope.project, '$projectDir/.fah/config.yaml'),
        (ProviderQueueScope.user, '$homeDir/.fah/config.yaml'),
      ])
        ?_queueScopeFromFile(scope, path),
    ],
  ];
  return resolveProviderQueueScopes(inputs);
}