elseware-nodejs 1.8.1 → 1.8.2

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
@@ -344,7 +344,8 @@ function loadEnv(options) {
344
344
  handleError(result.error);
345
345
  }
346
346
  logger.success("Env Configurations validated");
347
- return options.transform ? options.transform(result.data) : result.data;
347
+ const env = result.data;
348
+ return options.transform ? options.transform(env) : env;
348
349
  }
349
350
  function handleError(error) {
350
351
  logger.danger("Env validation failed");
@@ -354,20 +355,17 @@ function handleError(error) {
354
355
  const rawValue = key !== "unknown" ? process.env[key] : void 0;
355
356
  const isSecret = key.toLowerCase().includes("secret");
356
357
  const safeValue = isSecret ? "***" : rawValue;
357
- const messageParts = [
358
+ const message = [
358
359
  `message: ${err.message}`,
359
360
  `code: ${err.code}`,
360
361
  rawValue !== void 0 ? `value: ${JSON.stringify(safeValue)}` : null
361
- ].filter(Boolean);
362
- const fullMessage = messageParts.join(" | ");
362
+ ].filter(Boolean).join(" | ");
363
363
  if (!grouped[key]) grouped[key] = [];
364
- grouped[key].push(fullMessage);
364
+ grouped[key].push(message);
365
365
  });
366
366
  Object.entries(grouped).forEach(([key, messages]) => {
367
- logger.info(`${key}`);
368
- messages.forEach((msg) => {
369
- logger.log(` - ${msg}`);
370
- });
367
+ logger.info(key);
368
+ messages.forEach((msg) => logger.log(` - ${msg}`));
371
369
  });
372
370
  logger.danger("Application startup aborted!");
373
371
  process.exit(1);