Refactor: centralize development environment check with IS_DEV

Replaces scattered environment checks with the centralized `IS_DEV` constant from `config.ts`. This improves consistency and simplifies maintenance by reducing redundancy across multiple files.
This commit is contained in:
cyrus
2026-03-20 17:38:28 +05:30
parent e1145123db
commit 5b9a088141
8 changed files with 14 additions and 10 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ export const TELEGRAM_BOT_USERNAME =
export const TELEGRAM_BOT_ID = import.meta.env.VITE_TELEGRAM_BOT_ID || '8043922470';
export const IS_DEV = Boolean(import.meta.env.DEV) || import.meta.env.MODE === 'development';
export const IS_DEV = import.meta.env.DEV;
export const SKILLS_GITHUB_REPO = import.meta.env.VITE_SKILLS_GITHUB_REPO || 'alphahumanxyz/skills';
+2 -2
View File
@@ -1,6 +1,7 @@
/**
* Utilities for sanitizing sensitive data before logging
*/
import { IS_DEV } from './config';
const SENSITIVE_KEYS = [
'token',
@@ -75,8 +76,7 @@ function sanitizeObject(obj: unknown, depth = 0): unknown {
*/
export function sanitizeError(error: unknown): unknown {
if (error instanceof Error) {
const isDev = import.meta.env.DEV || import.meta.env.MODE === 'development';
return { name: error.name, message: error.message, stack: isDev ? error.stack : undefined };
return { name: error.name, message: error.message, stack: IS_DEV ? error.stack : undefined };
}
if (typeof error === 'object' && error !== null) {
return sanitizeObject(error);