mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
add anohter replacement support
This commit is contained in:
@@ -74,7 +74,7 @@ public class ZookeeperNodeListener extends NodeListener {
|
||||
* URL Template, e.g.
|
||||
* jdbc:mysql://${host}:${port}/${database}?useUnicode=true
|
||||
* ${host}, ${port} and ${database} will be replaced by values in ZK
|
||||
* ${} can also be #{}
|
||||
* ${host} can also be #{host} and #host#
|
||||
*/
|
||||
private String urlTemplate;
|
||||
|
||||
@@ -260,14 +260,17 @@ public class ZookeeperNodeListener extends NodeListener {
|
||||
if (properties.containsKey(dataPrefix + ".host")) {
|
||||
url = url.replace("${host}", properties.getProperty(dataPrefix + ".host"));
|
||||
url = url.replace("#{host}", properties.getProperty(dataPrefix + ".host"));
|
||||
url = url.replace("#host#", properties.getProperty(dataPrefix + ".host"));
|
||||
}
|
||||
if (properties.containsKey(dataPrefix + ".port")) {
|
||||
url = url.replace("${port}", properties.getProperty(dataPrefix + ".port"));
|
||||
url = url.replace("#{port}", properties.getProperty(dataPrefix + ".port"));
|
||||
url = url.replace("#port#", properties.getProperty(dataPrefix + ".port"));
|
||||
}
|
||||
if (properties.containsKey(dataPrefix + ".database")) {
|
||||
url = url.replace("${database}", properties.getProperty(dataPrefix + ".database"));
|
||||
url = url.replace("#{database}", properties.getProperty(dataPrefix + ".database"));
|
||||
url = url.replace("#database#", properties.getProperty(dataPrefix + ".database"));
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user