mirror of https://github.com/buster-so/buster.git
Refactor logging in environment validation scripts to use console.info for consistency
This commit is contained in:
parent
c658ebeeca
commit
76ac977adc
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
// Build-time environment validation
|
// 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)
|
// 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') {
|
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)'
|
'🐳 Docker/CI build detected - skipping environment validation (will validate at runtime)'
|
||||||
);
|
);
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
|
@ -38,14 +38,14 @@ for (const [envKey, value] of Object.entries(env)) {
|
||||||
console.error(`❌ Missing required environment variable: ${envKey}`);
|
console.error(`❌ Missing required environment variable: ${envKey}`);
|
||||||
hasErrors = true;
|
hasErrors = true;
|
||||||
} else {
|
} else {
|
||||||
console.log(`✅ ${envKey} is set`);
|
console.info(`✅ ${envKey} is set`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check Slack variables only if integration is enabled
|
// Check Slack variables only if integration is enabled
|
||||||
if (slackEnv.SLACK_INTEGRATION_ENABLED === 'true') {
|
if (slackEnv.SLACK_INTEGRATION_ENABLED === 'true') {
|
||||||
console.log('');
|
console.info('');
|
||||||
console.log('🔍 Slack integration is enabled. Validating Slack environment variables...');
|
console.info('🔍 Slack integration is enabled. Validating Slack environment variables...');
|
||||||
|
|
||||||
const requiredSlackVars = [
|
const requiredSlackVars = [
|
||||||
'SLACK_CLIENT_ID',
|
'SLACK_CLIENT_ID',
|
||||||
|
@ -59,11 +59,11 @@ if (slackEnv.SLACK_INTEGRATION_ENABLED === 'true') {
|
||||||
console.error(`❌ Missing required Slack environment variable: ${envKey}`);
|
console.error(`❌ Missing required Slack environment variable: ${envKey}`);
|
||||||
hasErrors = true;
|
hasErrors = true;
|
||||||
} else {
|
} else {
|
||||||
console.log(`✅ ${envKey} is set`);
|
console.info(`✅ ${envKey} is set`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log('ℹ️ Slack integration is disabled (SLACK_INTEGRATION_ENABLED != true)');
|
console.info('ℹ️ Slack integration is disabled (SLACK_INTEGRATION_ENABLED != true)');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasErrors) {
|
if (hasErrors) {
|
||||||
|
@ -73,4 +73,4 @@ if (hasErrors) {
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('✅ All required environment variables are present');
|
console.info('✅ All required environment variables are present');
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { db, messages } from '@buster/database';
|
import { db, messages } from '@buster/database';
|
||||||
import type { User } from '@buster/database';
|
import type { User } from '@buster/database';
|
||||||
import { eq } from 'drizzle-orm';
|
|
||||||
import type { ChatCreateHandlerRequest, ChatWithMessages } from '@buster/server-shared/chats';
|
import type { ChatCreateHandlerRequest, ChatWithMessages } from '@buster/server-shared/chats';
|
||||||
import { ChatError, ChatErrorCode } from '@buster/server-shared/chats';
|
import { ChatError, ChatErrorCode } from '@buster/server-shared/chats';
|
||||||
|
import { eq } from 'drizzle-orm';
|
||||||
import { handleExistingChat, handleNewChat } from './chat-helpers';
|
import { handleExistingChat, handleNewChat } from './chat-helpers';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
import { SlackError } from '@buster/server-shared/slack';
|
||||||
import { Hono } from 'hono';
|
import { Hono } from 'hono';
|
||||||
import { HTTPException } from 'hono/http-exception';
|
import { HTTPException } from 'hono/http-exception';
|
||||||
import { requireAuth } from '../../../middleware/auth';
|
import { requireAuth } from '../../../middleware/auth';
|
||||||
import { slackHandler } from './handler';
|
import { slackHandler } from './handler';
|
||||||
import { SlackError } from '@buster/server-shared/slack';
|
|
||||||
|
|
||||||
const app = new Hono()
|
const app = new Hono()
|
||||||
// Public endpoints (no auth required for OAuth flow)
|
// Public endpoints (no auth required for OAuth flow)
|
||||||
|
|
|
@ -6,7 +6,7 @@ config();
|
||||||
|
|
||||||
// Build-time environment validation
|
// Build-time environment validation
|
||||||
|
|
||||||
console.log('🔍 Validating environment variables...');
|
console.info('🔍 Validating environment variables...');
|
||||||
|
|
||||||
const env = {
|
const env = {
|
||||||
DATABASE_URL: process.env.DATABASE_URL,
|
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}`);
|
console.error(`❌ Missing required environment variable: ${envKey}`);
|
||||||
hasErrors = true;
|
hasErrors = true;
|
||||||
} else {
|
} else {
|
||||||
console.log(`✅ ${envKey} is set`);
|
console.info(`✅ ${envKey} is set`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,4 +34,4 @@ if (hasErrors) {
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('✅ All required environment variables are present');
|
console.info('✅ All required environment variables are present');
|
||||||
|
|
Loading…
Reference in New Issue