mirror of
https://github.com/hanzoai/chat.git
synced 2026-09-30 20:51:17 +00:00
librechat-data-provider → @hanzochat/data-provider @librechat/data-schemas → @hanzochat/data-schemas @librechat/client → @hanzochat/client (@hanzochat/api already forked; external @librechat/agents fork follows) All imports, package.json names/deps, tsconfig path aliases, jest moduleNameMapper, and rollup/vite build aliases updated. The data-provider react-query subpath resolves via the exports map. Lockfiles regenerated in a follow-on once the canonical package manager is confirmed.
28 lines
687 B
JavaScript
28 lines
687 B
JavaScript
const { logger } = require('@hanzochat/data-schemas');
|
|
const { getAppConfig } = require('~/server/services/Config');
|
|
|
|
const configMiddleware = async (req, res, next) => {
|
|
try {
|
|
const userRole = req.user?.role;
|
|
req.config = await getAppConfig({ role: userRole });
|
|
|
|
next();
|
|
} catch (error) {
|
|
logger.error('Config middleware error:', {
|
|
error: error.message,
|
|
userRole: req.user?.role,
|
|
path: req.path,
|
|
});
|
|
|
|
try {
|
|
req.config = await getAppConfig();
|
|
next();
|
|
} catch (fallbackError) {
|
|
logger.error('Fallback config middleware error:', fallbackError);
|
|
next(fallbackError);
|
|
}
|
|
}
|
|
};
|
|
|
|
module.exports = configMiddleware;
|