Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,14 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.6.0</version>
<version>42.7.5</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.github.mwiede/jsch -->
<dependency>
<groupId>com.github.mwiede</groupId>
<artifactId>jsch</artifactId>
<version>0.2.23</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.mindrot/jbcrypt -->
Expand Down
35 changes: 35 additions & 0 deletions src/main/java/com/carvalhotechsolutions/mundoanimal/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.carvalhotechsolutions.mundoanimal.utils.ScreenManager;
import javafx.application.Application;
import javafx.stage.Stage;
import com.jcraft.jsch.*;

public class Main extends Application {
@Override
Expand All @@ -27,6 +28,40 @@ public void start(Stage stage) {
}

public static void main(String[] args) {
// String sshHost = "ec2-**-***-***-***.sa-east-1.compute.amazonaws.com"; // Host do EC2
// int sshPort = **; // Porta SSH
// String sshUser = "***********"; // Usuário SSH
// String identityFilePath = "*:\\**\\**\\**\\**.pem"; // Caminho para a chave privada
//
// String remoteHost = "XXXXXXXXXXXXXXX.***********.sa-east-1.rds.amazonaws.com"; // Host do banco de dados
// int remotePort = ****; // Porta do banco de dados (PostgreSQL)
// int localPort = ****; // Porta local para o túnel
//
// // Cria a sessão SSH em um thread separado para não bloquear a interface
// new Thread(() -> {
// try {
// // Cria a sessão SSH
// JSch jsch = new JSch();
// jsch.addIdentity(identityFilePath); // Adiciona a chave privada para autenticação
//
// Session session = jsch.getSession(sshUser, sshHost, sshPort);
//
// session.setConfig("StrictHostKeyChecking", "no");
// session.setConfig("UserKnownHostsFile", "/dev/null");
//
// // Conecta à sessão SSH
// session.connect();
//
// // Cria o túnel SSH
// session.setPortForwardingL(localPort, remoteHost, remotePort);
//
// System.out.println("Túnel SSH criado com sucesso. Agora, a aplicação pode se conectar ao banco de dados.");
//
// launch();
// } catch (JSchException e) {
// e.printStackTrace();
// }
// }).start();
launch();
}
}
1 change: 1 addition & 0 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
requires java.desktop;
requires itextpdf;
requires jfreechart;
requires com.jcraft.jsch;

// Export and open the controllers package

Expand Down