mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 08:12:00 +02:00

* feat: allow only certain domain * Update dotenv.md * refactor( registrationController) & handle ALLOWED_REGISTRATION_DOMAINS not specified * cleanup and moved to AuthService for better error handling * refactor: replace environment variable with librechat config item, add typedef for custom config, update docs for new registration object and allowedDomains values * ci(AuthService): test for `isDomainAllowed` --------- Co-authored-by: Danny Avila <messagedaniel@protonmail.com>
25 lines
638 B
JavaScript
25 lines
638 B
JavaScript
const { CacheKeys } = require('librechat-data-provider');
|
|
const loadCustomConfig = require('~/server/services/Config/loadCustomConfig');
|
|
const getLogStores = require('./getLogStores');
|
|
|
|
/**
|
|
* Retrieves the configuration object
|
|
* @function getCustomConfig
|
|
* @returns {Promise<TCustomConfig | null>}
|
|
* */
|
|
async function getCustomConfig() {
|
|
const cache = getLogStores(CacheKeys.CONFIG_STORE);
|
|
let customConfig = await cache.get(CacheKeys.CUSTOM_CONFIG);
|
|
|
|
if (!customConfig) {
|
|
customConfig = await loadCustomConfig();
|
|
}
|
|
|
|
if (!customConfig) {
|
|
return null;
|
|
}
|
|
|
|
return customConfig;
|
|
}
|
|
|
|
module.exports = getCustomConfig;
|