elseware-nodejs 1.7.6 → 1.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -337,7 +337,7 @@ async function connectMongoDB(config) {
337
337
  process.exit(1);
338
338
  }
339
339
  }
340
- dotenv__default.default.config();
340
+ dotenv__default.default.config({ quiet: true });
341
341
  function loadEnv(options) {
342
342
  const result = options.schema.safeParse(process.env);
343
343
  if (!result.success) {
@@ -347,20 +347,29 @@ function loadEnv(options) {
347
347
  return options.transform ? options.transform(result.data) : result.data;
348
348
  }
349
349
  function handleError(error) {
350
- logger.danger("ENV VALIDATION FAILED");
350
+ logger.danger("Env validation failed");
351
351
  const grouped = {};
352
352
  error.issues.forEach((err) => {
353
353
  const key = err.path.join(".") || "unknown";
354
+ const rawValue = key !== "unknown" ? process.env[key] : void 0;
355
+ const isSecret = key.toLowerCase().includes("secret");
356
+ const safeValue = isSecret ? "***" : rawValue;
357
+ const messageParts = [
358
+ `message: ${err.message}`,
359
+ `code: ${err.code}`,
360
+ rawValue !== void 0 ? `value: ${JSON.stringify(safeValue)}` : null
361
+ ].filter(Boolean);
362
+ const fullMessage = messageParts.join(" | ");
354
363
  if (!grouped[key]) grouped[key] = [];
355
- grouped[key].push(err.message);
364
+ grouped[key].push(fullMessage);
356
365
  });
357
366
  Object.entries(grouped).forEach(([key, messages]) => {
358
367
  logger.info(`${key}`);
359
368
  messages.forEach((msg) => {
360
- logger.log(`${msg}`);
369
+ logger.log(` - ${msg}`);
361
370
  });
362
371
  });
363
- logger.danger("Application startup aborted.\n");
372
+ logger.danger("Application startup aborted!");
364
373
  process.exit(1);
365
374
  }
366
375