mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core&ui: goodbye, minio (#417)
This commit is contained in:
1 parent
7abc0a7d1b
commit
e06c86e9dd
34 files changed
+410
-322
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import { existsSync, readFileSync } from 'fs-extra';
|
||||
import { findFileSync } from '@hydrooj/utils/lib/utils';
|
||||
import { Logger } from './logger';
|
||||
|
||||
@@ -8,8 +8,8 @@ const logger = new Logger('options');
|
||||
|
||||
export = function load() {
|
||||
const envFile = path.resolve(os.homedir(), '.hydro', 'env');
|
||||
if (fs.existsSync(envFile)) {
|
||||
const content = fs.readFileSync(envFile).toString().replace(/\r/g, '');
|
||||
if (existsSync(envFile)) {
|
||||
const content = readFileSync(envFile).toString().replace(/\r/g, '');
|
||||
for (const line of content.split('\n')) {
|
||||
if (!line.includes('=')) continue;
|
||||
process.env[line.split('=')[0]] = line.split('=')[1].trim();
|
||||
@@ -19,7 +19,7 @@ export = function load() {
|
||||
if (!f) return null;
|
||||
let result: any = {};
|
||||
try {
|
||||
result = JSON.parse(fs.readFileSync(f).toString());
|
||||
result = JSON.parse(readFileSync(f, 'utf-8'));
|
||||
} catch (e) {
|
||||
logger.error('Cannot read config file %o', e);
|
||||
result = {};
|
||||
|
||||
Reference in new issue
Block a user