mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-30 23:14:37 +00:00
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:
+1
-1
@@ -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';
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user