Fix: Prevent Next.js env inlining and handle test-site in agentsMongo
This commit is contained in:
1 parent
997df2bc6b
commit
56c208f7c9
1 file changed
+4
-2
@@ -14,8 +14,10 @@ export async function fetchAgentsFromMongo(
|
||||
const filter: any = {};
|
||||
|
||||
if (!isCompanyRole && SITE_UUID) {
|
||||
if (SITE_UUID === 'all') {
|
||||
const envSites = (process.env.BACKONE_SITE_UUIDS || process.env.BACKONE_SITE_UUID || '').split(',').map(s => s.trim()).filter(Boolean);
|
||||
if (SITE_UUID === 'all' || SITE_UUID === 'test-site' || SITE_UUID === 'default') {
|
||||
// Use dynamic env access to prevent Next.js from inlining undefined during docker build
|
||||
const dynamicEnv = process['env'];
|
||||
const envSites = (dynamicEnv.BACKONE_SITE_UUIDS || dynamicEnv.BACKONE_SITE_UUID || '').split(',').map(s => s.trim()).filter(Boolean);
|
||||
if (envSites.length > 0) {
|
||||
filter.site_uuid = { $in: [...envSites, 'global'] };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user