mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
交互式安装
This commit is contained in:
1 parent
6134a16f8c
commit
27cfe81e31
21 files changed
+333
-181
No files matched your search
+5
-9
@@ -51,14 +51,10 @@ let options = {
|
||||
},
|
||||
};
|
||||
|
||||
try {
|
||||
let f = path.resolve(process.cwd(), 'config.yaml');
|
||||
if (!fs.existsSync(f)) f = path.resolve(os.homedir(), '.config', 'hydro', 'config.yaml');
|
||||
if (!fs.existsSync(f)) f = path.resolve('/config/config.yaml');
|
||||
const t = yaml.safeLoad(fs.readFileSync(f));
|
||||
options = defaultsDeep(t, options);
|
||||
} catch (e) {
|
||||
console.error('Cannot load config');
|
||||
}
|
||||
let f = path.resolve(process.cwd(), 'config.json');
|
||||
if (!fs.existsSync(f)) f = path.resolve(os.homedir(), '.config', 'hydro', 'config.json');
|
||||
if (!fs.existsSync(f)) f = path.resolve('/config/config.json');
|
||||
const t = JSON.parse(fs.readFileSync(f));
|
||||
options = defaultsDeep(t, options);
|
||||
|
||||
module.exports = options;
|
||||
Reference in new issue
Block a user