(settings: ReturnType<typeof getSettings>)
| 666 | } |
| 667 | |
| 668 | async function tryAuthenticate(settings: ReturnType<typeof getSettings>) { |
| 669 | if (!settings.auth.apiKey) { |
| 670 | return null; |
| 671 | } |
| 672 | |
| 673 | try { |
| 674 | const authenticator = createAuthenticator({ |
| 675 | apiKey: settings.auth.apiKey, |
| 676 | apiUrl: settings.auth.apiUrl, |
| 677 | }); |
| 678 | const user = await authenticator.whoami(); |
| 679 | return user; |
| 680 | } catch (error) { |
| 681 | return null; |
| 682 | } |
| 683 | } |
| 684 | |
| 685 | function validateParams( |
| 686 | i18nConfig: I18nConfig | null, |
no test coverage detected