提交 a5723a52 编写于 作者: E Evgeny Fradkin

#2213 Use environment variables in all the connection properties

上级 c7cfaadc
...@@ -358,12 +358,18 @@ public class DBPConnectionConfiguration implements DBPObject ...@@ -358,12 +358,18 @@ public class DBPConnectionConfiguration implements DBPObject
} }
public void resolveSystemEnvironmentVariables() { public void resolveSystemEnvironmentVariables() {
hostName = GeneralUtils.replaceSystemEnvironmentVariables(hostName); hostName = hostName != null ? GeneralUtils.replaceSystemEnvironmentVariables(hostName) : null;
hostPort = GeneralUtils.replaceSystemEnvironmentVariables(hostPort); hostPort = hostPort != null ? GeneralUtils.replaceSystemEnvironmentVariables(hostPort) : null;
serverName = GeneralUtils.replaceSystemEnvironmentVariables(serverName); serverName = serverName != null ? GeneralUtils.replaceSystemEnvironmentVariables(serverName) : null;
databaseName = GeneralUtils.replaceSystemEnvironmentVariables(databaseName); databaseName = databaseName != null ? GeneralUtils.replaceSystemEnvironmentVariables(databaseName) : null;
userName = GeneralUtils.replaceSystemEnvironmentVariables(userName); userName = userName != null ? GeneralUtils.replaceSystemEnvironmentVariables(userName) : null;
userPassword = GeneralUtils.replaceSystemEnvironmentVariables(userPassword); userPassword = userPassword != null ? GeneralUtils.replaceSystemEnvironmentVariables(userPassword) : null;
url = GeneralUtils.replaceSystemEnvironmentVariables(url); url = url != null ? GeneralUtils.replaceSystemEnvironmentVariables(url) : null;
for (String prop : this.properties.keySet()) {
String value = this.properties.get(prop);
if (!CommonUtils.isEmpty(value)) {
this.properties.put(prop, GeneralUtils.replaceSystemEnvironmentVariables(value));
}
}
} }
} }
...@@ -20,8 +20,6 @@ import org.jkiss.code.NotNull; ...@@ -20,8 +20,6 @@ import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable; import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException; import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.model.connection.DBPDriver; import org.jkiss.dbeaver.model.connection.DBPDriver;
import org.jkiss.dbeaver.model.impl.net.SSHConstants;
import org.jkiss.dbeaver.model.impl.net.SocksConstants;
import org.jkiss.dbeaver.utils.GeneralUtils; import org.jkiss.dbeaver.utils.GeneralUtils;
import org.jkiss.utils.CommonUtils; import org.jkiss.utils.CommonUtils;
...@@ -157,9 +155,9 @@ public class DBWHandlerConfiguration { ...@@ -157,9 +155,9 @@ public class DBWHandlerConfiguration {
} }
public void resolveSystemEnvironmentVariables() { public void resolveSystemEnvironmentVariables() {
userName = GeneralUtils.replaceSystemEnvironmentVariables(userName); userName = userName != null ? GeneralUtils.replaceSystemEnvironmentVariables(userName) : null;
password = GeneralUtils.replaceSystemEnvironmentVariables(password); password = password != null ? GeneralUtils.replaceSystemEnvironmentVariables(password) : null;
for (String prop : new String[] {SSHConstants.PROP_HOST, SSHConstants.PROP_PORT, SocksConstants.PROP_HOST, SocksConstants.PROP_PORT}) { for (String prop : this.properties.keySet()) {
String value = this.properties.get(prop); String value = this.properties.get(prop);
if (!CommonUtils.isEmpty(value)) { if (!CommonUtils.isEmpty(value)) {
this.properties.put(prop, GeneralUtils.replaceSystemEnvironmentVariables(value)); this.properties.put(prop, GeneralUtils.replaceSystemEnvironmentVariables(value));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册