secureKeyPreloadNames function
Every provider key name the startup snapshot must preload: each catalog
provider's env names, the endpoint-scoped FA_KEY_<HOST> name for every
catalog default endpoint plus the configured endpoint and every saved
custom provider's, the two non-catalog media slots, and the explicit
apiKeyNames referenced by the roles config.
Implementation
Set<String> secureKeyPreloadNames(CliConfig saved, {required String? baseUrl}) {
return {
for (final spec in providerCatalog.values) ...[
...spec.apiKeyEnvNames,
// Endpoint-scoped keys (FA_KEY_<HOST>): catalog defaults.
CustomProviderRegistry.keyNameFor(spec.defaultBaseUrl),
],
if (baseUrl != null) CustomProviderRegistry.keyNameFor(baseUrl),
for (final entry in saved.customProviders)
entry.keyName ?? CustomProviderRegistry.keyNameFor(entry.baseUrl),
'VISION_API_KEY',
'TRANSCRIBE_API_KEY',
if (saved.modelRoles != null) ...roleKeyNames(saved.modelRoles!),
};
}