From 76ac977adc7dd26f858db8f956973b1a0f92ac2d Mon Sep 17 00:00:00 2001 From: dal Date: Mon, 7 Jul 2025 11:33:33 -0600 Subject: [PATCH] Refactor logging in environment validation scripts to use console.info for consistency --- apps/server/scripts/validate-env.js | 16 ++++++++-------- .../src/api/v2/chats/services/chat-service.ts | 2 +- apps/server/src/api/v2/slack/index.ts | 2 +- apps/trigger/scripts/validate-env.js | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/apps/server/scripts/validate-env.js b/apps/server/scripts/validate-env.js index d3bad4110..fc5469f91 100644 --- a/apps/server/scripts/validate-env.js +++ b/apps/server/scripts/validate-env.js @@ -2,11 +2,11 @@ // Build-time environment validation -console.log('🔍 Validating environment variables...'); +console.info('🔍 Validating environment variables...'); // Skip validation during Docker builds (environment variables are only available at runtime) if (process.env.DOCKER_BUILD || process.env.CI || process.env.NODE_ENV === 'production') { - console.log( + console.info( 'đŸŗ Docker/CI build detected - skipping environment validation (will validate at runtime)' ); process.exit(0); @@ -38,14 +38,14 @@ for (const [envKey, value] of Object.entries(env)) { console.error(`❌ Missing required environment variable: ${envKey}`); hasErrors = true; } else { - console.log(`✅ ${envKey} is set`); + console.info(`✅ ${envKey} is set`); } } // Check Slack variables only if integration is enabled if (slackEnv.SLACK_INTEGRATION_ENABLED === 'true') { - console.log(''); - console.log('🔍 Slack integration is enabled. Validating Slack environment variables...'); + console.info(''); + console.info('🔍 Slack integration is enabled. Validating Slack environment variables...'); const requiredSlackVars = [ 'SLACK_CLIENT_ID', @@ -59,11 +59,11 @@ if (slackEnv.SLACK_INTEGRATION_ENABLED === 'true') { console.error(`❌ Missing required Slack environment variable: ${envKey}`); hasErrors = true; } else { - console.log(`✅ ${envKey} is set`); + console.info(`✅ ${envKey} is set`); } } } else { - console.log('â„šī¸ Slack integration is disabled (SLACK_INTEGRATION_ENABLED != true)'); + console.info('â„šī¸ Slack integration is disabled (SLACK_INTEGRATION_ENABLED != true)'); } if (hasErrors) { @@ -73,4 +73,4 @@ if (hasErrors) { process.exit(1); } -console.log('✅ All required environment variables are present'); +console.info('✅ All required environment variables are present'); diff --git a/apps/server/src/api/v2/chats/services/chat-service.ts b/apps/server/src/api/v2/chats/services/chat-service.ts index fb5237671..6e6dbf354 100644 --- a/apps/server/src/api/v2/chats/services/chat-service.ts +++ b/apps/server/src/api/v2/chats/services/chat-service.ts @@ -1,8 +1,8 @@ import { db, messages } from '@buster/database'; import type { User } from '@buster/database'; -import { eq } from 'drizzle-orm'; import type { ChatCreateHandlerRequest, ChatWithMessages } from '@buster/server-shared/chats'; import { ChatError, ChatErrorCode } from '@buster/server-shared/chats'; +import { eq } from 'drizzle-orm'; import { handleExistingChat, handleNewChat } from './chat-helpers'; /** diff --git a/apps/server/src/api/v2/slack/index.ts b/apps/server/src/api/v2/slack/index.ts index 915589b80..0c4ab8275 100644 --- a/apps/server/src/api/v2/slack/index.ts +++ b/apps/server/src/api/v2/slack/index.ts @@ -1,8 +1,8 @@ +import { SlackError } from '@buster/server-shared/slack'; import { Hono } from 'hono'; import { HTTPException } from 'hono/http-exception'; import { requireAuth } from '../../../middleware/auth'; import { slackHandler } from './handler'; -import { SlackError } from '@buster/server-shared/slack'; const app = new Hono() // Public endpoints (no auth required for OAuth flow) diff --git a/apps/trigger/scripts/validate-env.js b/apps/trigger/scripts/validate-env.js index f3ddce5d9..35d42e498 100644 --- a/apps/trigger/scripts/validate-env.js +++ b/apps/trigger/scripts/validate-env.js @@ -6,7 +6,7 @@ config(); // Build-time environment validation -console.log('🔍 Validating environment variables...'); +console.info('🔍 Validating environment variables...'); const env = { DATABASE_URL: process.env.DATABASE_URL, @@ -23,7 +23,7 @@ for (const [envKey, value] of Object.entries(env)) { console.error(`❌ Missing required environment variable: ${envKey}`); hasErrors = true; } else { - console.log(`✅ ${envKey} is set`); + console.info(`✅ ${envKey} is set`); } } @@ -34,4 +34,4 @@ if (hasErrors) { process.exit(1); } -console.log('✅ All required environment variables are present'); +console.info('✅ All required environment variables are present');