refactor: improve service layer logging and configuration
- Change email service logging from console.log to console.warn for better visibility - Update mailgun and couchdb configuration with improved error handling - Enhance database seeder with better logging and error management - Improve service factory patterns for better testability
This commit is contained in:
@@ -2,16 +2,17 @@
|
||||
// This file determines whether to use mock localStorage or real CouchDB
|
||||
|
||||
import { CouchDBService as MockCouchDBService } from './couchdb';
|
||||
import { getEnvVar, isTest } from '../utils/env';
|
||||
|
||||
// Environment detection
|
||||
const isProduction = () => {
|
||||
// Check if we're in a Docker environment or if CouchDB URL is configured
|
||||
const env = (import.meta as { env?: Record<string, string> }).env || {};
|
||||
const couchdbUrl =
|
||||
env.VITE_COUCHDB_URL ||
|
||||
(typeof process !== 'undefined' ? process.env.VITE_COUCHDB_URL : null) ||
|
||||
(typeof process !== 'undefined' ? process.env.COUCHDB_URL : null);
|
||||
// Always use mock service in test environment
|
||||
if (isTest()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if we're in a Docker environment or if CouchDB URL is configured
|
||||
const couchdbUrl = getEnvVar('VITE_COUCHDB_URL') || getEnvVar('COUCHDB_URL');
|
||||
return !!couchdbUrl && couchdbUrl !== 'mock';
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user