| import logger from '~/config/winston'; |
| import { removeNullishValues } from 'librechat-data-provider'; |
| import type { TCustomConfig, TConfigDefaults } from 'librechat-data-provider'; |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| export function loadTurnstileConfig( |
| config: Partial<TCustomConfig> | undefined, |
| configDefaults: TConfigDefaults, |
| ): Partial<TCustomConfig['turnstile']> { |
| const { turnstile: customTurnstile } = config ?? {}; |
| const { turnstile: defaults } = configDefaults; |
|
|
| const loadedTurnstile = removeNullishValues({ |
| siteKey: |
| customTurnstile?.siteKey ?? (defaults as TCustomConfig['turnstile'] | undefined)?.siteKey, |
| options: |
| customTurnstile?.options ?? (defaults as TCustomConfig['turnstile'] | undefined)?.options, |
| }); |
|
|
| const enabled = Boolean(loadedTurnstile.siteKey); |
|
|
| if (enabled) { |
| logger.debug( |
| 'Turnstile is ENABLED with configuration:\n' + JSON.stringify(loadedTurnstile, null, 2), |
| ); |
| } else { |
| logger.debug('Turnstile is DISABLED (no siteKey provided).'); |
| } |
|
|
| return loadedTurnstile; |
| } |
|
|