pull/101/head
xiaojunnuo 2024-07-15 02:13:53 +08:00
parent b1688525db
commit bf6f1d8137
3 changed files with 15 additions and 26 deletions

View File

@ -11,8 +11,8 @@ run/
*.un~ *.un~
.tsbuildinfo .tsbuildinfo
.tsbuildinfo.* .tsbuildinfo.*
./data
./test/**/*.js /test/**/*.js
/test/setup.js /test/setup.js
/test/setup.ts /test/setup.ts
/data/

View File

@ -0,0 +1,9 @@
export class License {
crt: string;
expireTime: number;
activeTime: number;
async load() {
// load license.pem
}
}

View File

@ -1,12 +1,4 @@
import { import { AbstractTaskPlugin, IAccessService, ILogger, IsTaskPlugin, RunStrategy, TaskInput, TaskOutput } from '@certd/pipeline';
AbstractTaskPlugin,
IAccessService,
ILogger,
IsTaskPlugin,
RunStrategy,
TaskInput,
TaskOutput,
} from '@certd/pipeline';
import { SshClient } from '../../lib/ssh.js'; import { SshClient } from '../../lib/ssh.js';
import { CertInfo, CertReader } from '@certd/plugin-cert'; import { CertInfo, CertReader } from '@certd/plugin-cert';
import * as fs from 'fs'; import * as fs from 'fs';
@ -120,20 +112,13 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin {
this.logger.info('复制到目标路径'); this.logger.info('复制到目标路径');
this.copyFile(saveCrtPath, crtPath); this.copyFile(saveCrtPath, crtPath);
this.copyFile(saveKeyPath, keyPath); this.copyFile(saveKeyPath, keyPath);
this.logger.info( this.logger.info('证书复制成功crtPath=', crtPath, ',keyPath=', keyPath);
'证书复制成功crtPath=',
crtPath,
',keyPath=',
keyPath
);
} else { } else {
if (!accessId) { if (!accessId) {
throw new Error('主机登录授权配置不能为空'); throw new Error('主机登录授权配置不能为空');
} }
this.logger.info('准备上传文件到服务器'); this.logger.info('准备上传文件到服务器');
const connectConf: SshAccess = await this.accessService.getById( const connectConf: SshAccess = await this.accessService.getById(accessId);
accessId
);
const sshClient = new SshClient(this.logger); const sshClient = new SshClient(this.logger);
await sshClient.uploadFiles({ await sshClient.uploadFiles({
connectConf, connectConf,
@ -149,12 +134,7 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin {
], ],
mkdirs: this.mkdirs, mkdirs: this.mkdirs,
}); });
this.logger.info( this.logger.info('证书上传成功crtPath=', crtPath, ',keyPath=', keyPath);
'证书上传成功crtPath=',
crtPath,
',keyPath=',
keyPath
);
} }
} catch (e) { } catch (e) {
this.logger.error(`上传失败:${e.message}`); this.logger.error(`上传失败:${e.message}`);