update
This commit is contained in:
@@ -17,8 +17,11 @@ export class Tunnel {
|
||||
@Column()
|
||||
username: string;
|
||||
|
||||
@Column({ select: false })
|
||||
password: string;
|
||||
@Column({ select: false, nullable: true })
|
||||
password?: string;
|
||||
|
||||
@Column({ type: 'text', select: false, nullable: true })
|
||||
privateKey?: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
domain: string;
|
||||
|
||||
@@ -6,7 +6,7 @@ export class SshService {
|
||||
private readonly logger = new Logger(SshService.name);
|
||||
|
||||
async executeCommand(
|
||||
config: { host: string; port: number; username: string; password?: string },
|
||||
config: { host: string; port: number; username: string; password?: string, privateKey?: string },
|
||||
command: string
|
||||
): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -42,6 +42,7 @@ export class SshService {
|
||||
port: config.port,
|
||||
username: config.username,
|
||||
password: config.password,
|
||||
privateKey: config.privateKey,
|
||||
readyTimeout: 20000,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -31,6 +31,7 @@ export class TunnelsService {
|
||||
async installScript(id: number) {
|
||||
const tunnel = await this.tunnelRepo.createQueryBuilder('tunnel')
|
||||
.addSelect('tunnel.password')
|
||||
.addSelect('tunnel.privateKey')
|
||||
.where('tunnel.id = :id', { id })
|
||||
.getOne();
|
||||
|
||||
@@ -55,7 +56,8 @@ export class TunnelsService {
|
||||
host: tunnel.ip,
|
||||
port: tunnel.sshPort,
|
||||
username: tunnel.username,
|
||||
password: tunnel.password
|
||||
password: tunnel.password,
|
||||
privateKey: tunnel.privateKey
|
||||
}, command);
|
||||
|
||||
this.logger.log(`Скрипт выполнен успешно:\n${output}`);
|
||||
|
||||
Reference in New Issue
Block a user