mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: ensure char '=' exists
This commit is contained in:
1 parent
4e6553033e
commit
4d6f6dcdb2
2 files changed
+3
-2
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.37.7",
|
"version": "2.37.8",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/loader",
|
"main": "src/loader",
|
||||||
"module": "src/loader",
|
"module": "src/loader",
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ export = function load() {
|
|||||||
const envFile = path.resolve(os.homedir(), '.hydro', 'env');
|
const envFile = path.resolve(os.homedir(), '.hydro', 'env');
|
||||||
if (fs.existsSync(envFile)) {
|
if (fs.existsSync(envFile)) {
|
||||||
const content = fs.readFileSync(envFile).toString().replace(/\r/g, '');
|
const content = fs.readFileSync(envFile).toString().replace(/\r/g, '');
|
||||||
for (const line of content.split('\n').filter((l) => l.trim())) {
|
for (const line of content.split('\n')) {
|
||||||
|
if (!line.includes('=')) continue;
|
||||||
process.env[line.split('=')[0]] = line.split('=')[1].trim();
|
process.env[line.split('=')[0]] = line.split('=')[1].trim();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user