mirror of
https://github.com/samanhappy/mcphub.git
synced 2025-12-24 02:39:19 -05:00
feat: enhance BearerKeyDaoImpl to handle migration and caching behavior for bearer keys (#507)
This commit is contained in:
@@ -24,7 +24,10 @@ export class BearerKeyDaoImpl extends JsonFileBaseDao implements BearerKeyDao {
|
||||
private async loadKeysWithMigration(): Promise<BearerKey[]> {
|
||||
const settings = await this.loadSettings();
|
||||
|
||||
if (Array.isArray(settings.bearerKeys) && settings.bearerKeys.length > 0) {
|
||||
// Treat an existing array (including an empty array) as already migrated.
|
||||
// Otherwise, when there are no configured keys, we'd rewrite mcp_settings.json
|
||||
// on every request, which also clears the global settings cache.
|
||||
if (Array.isArray(settings.bearerKeys)) {
|
||||
return settings.bearerKeys;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user