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

#2213 Use environment variables in all the connection properties

上级 c7cfaadc
......@@ -358,12 +358,18 @@ public class DBPConnectionConfiguration implements DBPObject
}
public void resolveSystemEnvironmentVariables() {
hostName = GeneralUtils.replaceSystemEnvironmentVariables(hostName);
hostPort = GeneralUtils.replaceSystemEnvironmentVariables(hostPort);
serverName = GeneralUtils.replaceSystemEnvironmentVariables(serverName);
databaseName = GeneralUtils.replaceSystemEnvironmentVariables(databaseName);
userName = GeneralUtils.replaceSystemEnvironmentVariables(userName);
userPassword = GeneralUtils.replaceSystemEnvironmentVariables(userPassword);
url = GeneralUtils.replaceSystemEnvironmentVariables(url);
hostName = hostName != null ? GeneralUtils.replaceSystemEnvironmentVariables(hostName) : null;
hostPort = hostPort != null ? GeneralUtils.replaceSystemEnvironmentVariables(hostPort) : null;
serverName = serverName != null ? GeneralUtils.replaceSystemEnvironmentVariables(serverName) : null;
databaseName = databaseName != null ? GeneralUtils.replaceSystemEnvironmentVariables(databaseName) : null;
userName = userName != null ? GeneralUtils.replaceSystemEnvironmentVariables(userName) : null;
userPassword = userPassword != null ? GeneralUtils.replaceSystemEnvironmentVariables(userPassword) : null;
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;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
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.utils.CommonUtils;
......@@ -157,9 +155,9 @@ public class DBWHandlerConfiguration {
}
public void resolveSystemEnvironmentVariables() {
userName = GeneralUtils.replaceSystemEnvironmentVariables(userName);
password = GeneralUtils.replaceSystemEnvironmentVariables(password);
for (String prop : new String[] {SSHConstants.PROP_HOST, SSHConstants.PROP_PORT, SocksConstants.PROP_HOST, SocksConstants.PROP_PORT}) {
userName = userName != null ? GeneralUtils.replaceSystemEnvironmentVariables(userName) : null;
password = password != null ? GeneralUtils.replaceSystemEnvironmentVariables(password) : null;
for (String prop : this.properties.keySet()) {
String value = this.properties.get(prop);
if (!CommonUtils.isEmpty(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.
先完成此消息的编辑!
想要评论请 注册