feature/task-38-roles #39

Merged
L_DelOff merged 7 commits from feature/task-38-roles into master 2024-01-21 20:17:38 +03:00
2 changed files with 6 additions and 0 deletions
Showing only changes of commit 25b73feb48 - Show all commits

View File

@@ -5,6 +5,7 @@ import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.Session;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Repository;
import org.telegram.telegrambots.meta.api.methods.send.SendMessage;
import ru.ldeloff.servermonitorbot.config.SshConfig;
@@ -20,6 +21,9 @@ public class SshRepositoryImpl implements SshRepository {
private final List<SshServer> sshServers;
@Value("${ssh.timeout:5000}")
private int TIMEOUT;
@Autowired
public SshRepositoryImpl(SshConfig sshConfig) {
this.sshServers = sshConfig.getServers();
@@ -48,6 +52,7 @@ public class SshRepositoryImpl implements SshRepository {
sshServer.getPort());
session.setPassword(sshServer.getPassword());
session.setConfig("StrictHostKeyChecking", "no");
session.setTimeout(TIMEOUT);
session.connect();
return session;
}

View File

@@ -17,6 +17,7 @@ bot:
- telegramId: 123456789
role: admin
ssh:
timeout: 5000
servers:
-
name: "Server Name"