moltspay 0.8.6 → 0.8.7

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.mjs CHANGED
@@ -30355,20 +30355,34 @@ var USDC_DOMAIN = {
30355
30355
  version: "2"
30356
30356
  };
30357
30357
  function loadEnvFiles() {
30358
- try {
30359
- const dotenv = __require("dotenv");
30360
- const envPaths = [
30361
- path2.join(process.cwd(), ".env"),
30362
- path2.join(process.env.HOME || "", ".moltspay", ".env")
30363
- ];
30364
- for (const envPath of envPaths) {
30365
- if (existsSync(envPath)) {
30366
- dotenv.config({ path: envPath });
30358
+ const envPaths = [
30359
+ path2.join(process.cwd(), ".env"),
30360
+ path2.join(process.env.HOME || "", ".moltspay", ".env")
30361
+ ];
30362
+ for (const envPath of envPaths) {
30363
+ if (existsSync(envPath)) {
30364
+ try {
30365
+ const content = readFileSync(envPath, "utf-8");
30366
+ for (const line of content.split("\n")) {
30367
+ const trimmed = line.trim();
30368
+ if (!trimmed || trimmed.startsWith("#")) continue;
30369
+ const eqIndex = trimmed.indexOf("=");
30370
+ if (eqIndex === -1) continue;
30371
+ const key = trimmed.slice(0, eqIndex).trim();
30372
+ let value = trimmed.slice(eqIndex + 1).trim();
30373
+ if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
30374
+ value = value.slice(1, -1);
30375
+ }
30376
+ if (!process.env[key]) {
30377
+ process.env[key] = value;
30378
+ }
30379
+ }
30367
30380
  console.log(`[MoltsPay] Loaded config from ${envPath}`);
30368
30381
  break;
30382
+ } catch (err) {
30383
+ console.warn(`[MoltsPay] Failed to load ${envPath}:`, err);
30369
30384
  }
30370
30385
  }
30371
- } catch {
30372
30386
  }
30373
30387
  }
30374
30388
  function getCDPConfig() {