Update zalo-userbot/userbot.js
This commit is contained in:
parent
05516149e2
commit
8527a638e0
|
|
@ -22,6 +22,24 @@ process.stderr.on("error", (err) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Load parent .env file to sync config with Laravel
|
||||||
|
try {
|
||||||
|
const parentEnvPath = path.resolve(process.cwd(), "../.env");
|
||||||
|
if (fs.existsSync(parentEnvPath)) {
|
||||||
|
const envContent = fs.readFileSync(parentEnvPath, "utf-8");
|
||||||
|
envContent.split(/\r?\n/).forEach(line => {
|
||||||
|
const trimmed = line.trim();
|
||||||
|
if (trimmed && !trimmed.startsWith("#") && trimmed.includes("=")) {
|
||||||
|
const [key, ...valueParts] = trimmed.split("=");
|
||||||
|
const value = valueParts.join("=").trim().replace(/^[\\'"\s]+|[\\'"\s]+$/g, "");
|
||||||
|
process.env[key.trim()] = value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error("Warning: Failed to load parent .env file:", err.message);
|
||||||
|
}
|
||||||
|
|
||||||
const BASE_URL = process.env.APP_URL
|
const BASE_URL = process.env.APP_URL
|
||||||
? process.env.APP_URL.trim().replace(/^[\\'"\s]+|[\\'"\s]+$/g, "").replace(/\/$/, "")
|
? process.env.APP_URL.trim().replace(/^[\\'"\s]+|[\\'"\s]+$/g, "").replace(/\/$/, "")
|
||||||
: "http://127.0.0.1:8000";
|
: "http://127.0.0.1:8000";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user