🔨 chore: add ENABLE_BOT_IN_DEV swtich (#13883)

* chore: add  ENABLE_BOT_IN_DEV swtich

* chore: add explicit judge
This commit is contained in:
Rdmclin2 2026-04-16 17:47:31 +08:00 committed by GitHub
parent 843248fb77
commit 2cfcd4a75f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -7,10 +7,13 @@ export async function register() {
// Auto-start GatewayManager on server start for non-Vercel environments (Docker, local).
// Persistent bots need reconnection after restart.
// On Vercel, the cron job at /api/agent/gateway handles this reliably instead.
// In local dev, opt-in via ENABLE_BOT_IN_DEV to avoid clobbering a shared bot binding.
const isDev = process.env.NODE_ENV !== 'production';
if (
process.env.NEXT_RUNTIME === 'nodejs' &&
process.env.DATABASE_URL &&
!process.env.VERCEL_ENV
!process.env.VERCEL_ENV &&
(!isDev || process.env.ENABLE_BOT_IN_DEV === '1')
) {
const { GatewayService } = await import('./server/services/gateway');
const service = new GatewayService();