core: trim config

This commit is contained in:
undefined committed 2021-09-22 13:27:23 +08:00
1 parent d30dc1e466
commit 1140f85654
2 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "hydrooj", "name": "hydrooj",
"version": "2.37.4", "version": "2.37.5",
"bin": "bin/hydrooj.js", "bin": "bin/hydrooj.js",
"main": "src/loader", "main": "src/loader",
"module": "src/loader", "module": "src/loader",
+2 -2
View File
@@ -9,9 +9,9 @@ const logger = new Logger('options');
export = function load() { 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(); const content = fs.readFileSync(envFile).toString().replace(/\r/g, '');
for (const line of content.split('\n')) { for (const line of content.split('\n')) {
process.env[line.split('=')[0]] = line.split('=')[1]; process.env[line.split('=')[0]] = line.split('=')[1].trim();
} }
} }
const f = findFileSync('config.json', false); const f = findFileSync('config.json', false);