Fix _port not parsing from connection string

This commit is contained in:
2022-12-12 12:32:46 -05:00
parent bdaa3ab3d5
commit 72e1f1da6e
+5 -1
View File
@@ -41,7 +41,11 @@ namespace LeafWeb.Core.Remote
var conn = new DbConnectionStringBuilder {ConnectionString = connectionString};
_host = conn["host"] as string;
_port = int.Parse(conn["port"] as string ?? "22"); // default 22
// TODO: fix this, exception when port is not present
if (conn.ContainsKey("port"))
_port = int.Parse(conn["port"] as string ?? "22"); // default 22
else
_port = 22;
var username = conn["username"] as string;
var password = conn["password"] as string;
_connectionInfo = new PasswordConnectionInfo(_host, _port, username, password);