chore: basic 从pipeline中移除

This commit is contained in:
xiaojunnuo
2024-11-04 15:14:56 +08:00
parent 0f572f4cb3
commit 1274f56da8
38 changed files with 128 additions and 58 deletions
@@ -10,7 +10,7 @@ import { UserEntity } from '../modules/sys/authority/entity/user.js';
import { PipelineEntity } from '../modules/pipeline/entity/pipeline.js';
//import { logger } from '../utils/logger';
// load .env file in process.cwd
import { mergeConfig } from './loader.js';
import { loadDotEnv, mergeConfig } from './loader.js';
import { libServerEntities } from '@certd/lib-server';
import { commercialEntities } from '@certd/commercial-core';
import { tmpdir } from 'node:os';
@@ -123,6 +123,8 @@ const development = {
contactLink: '',
},
} as MidwayConfig;
loadDotEnv();
mergeConfig(development, 'development');
mergeConfig(development, env);
@@ -46,3 +46,14 @@ export function mergeConfig(config: any, envType: string) {
}
return config;
}
export function loadDotEnv() {
const envStr = fs.readFileSync('.env').toString();
envStr.split('\n').forEach(line => {
const [key, value] = line.split('=');
const oldValue = process.env[key];
if (!oldValue) {
process.env[key] = value;
}
});
}
@@ -86,6 +86,7 @@ export class AsyncSsh2Client {
sftp.fastPut(localPath, remotePath, (err: Error) => {
if (err) {
reject(err);
this.logger.error('请确认路径是否包含文件名,路径本身不能是目录,路径不能有*?之类的特殊符号,要有写入权限');
return;
}
this.logger.info(`上传文件成功:${localPath} => ${remotePath}`);