This commit is contained in:
Den Piligrim
2026-03-21 13:24:47 +03:00
parent 21ae964012
commit 5b2870e04a
17 changed files with 386 additions and 152 deletions
+5 -2
View File
@@ -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;
+2 -1
View File
@@ -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,
});
});
+3 -1
View File
@@ -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}`);