完善拉取私有仓库

This commit is contained in:
whyour
2022-05-18 01:14:10 +08:00
parent 1695b8c0fe
commit 7caabe9063
6 changed files with 96 additions and 34 deletions
+8
View File
@@ -1,5 +1,6 @@
import fs from 'fs';
import path from 'path';
import os from 'os';
import dotenv from 'dotenv';
import Logger from './logger';
import { fileExist } from '../config/util';
@@ -15,6 +16,8 @@ const confFile = path.join(configPath, 'config.sh');
const authConfigFile = path.join(configPath, 'auth.json');
const sampleConfigFile = path.join(samplePath, 'config.sample.sh');
const sampleAuthFile = path.join(samplePath, 'auth.sample.json');
const homedir = os.homedir();
const sshPath = path.resolve(homedir, '.ssh');
export default async () => {
const authFileExist = await fileExist(authConfigFile);
@@ -23,6 +26,7 @@ export default async () => {
const logDirExist = await fileExist(logPath);
const configDirExist = await fileExist(configPath);
const uploadDirExist = await fileExist(uploadPath);
const sshDirExist = await fileExist(sshPath);
if (!configDirExist) {
fs.mkdirSync(configPath);
@@ -48,6 +52,10 @@ export default async () => {
fs.mkdirSync(uploadPath);
}
if (!sshDirExist) {
fs.mkdirSync(sshPath);
}
dotenv.config({ path: confFile });
Logger.info('✌️ Init file down');