You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by GitBox <gi...@apache.org> on 2022/05/05 07:57:01 UTC
[GitHub] [jackrabbit-oak] thomasmueller commented on a diff in pull request #557: OAK-9753: ES connection parameters should be easily accessible from E…
thomasmueller commented on code in PR #557:
URL: https://github.com/apache/jackrabbit-oak/pull/557#discussion_r865642479
##########
oak-search-elastic/src/test/java/org/apache/jackrabbit/oak/plugins/index/elastic/ElasticConnectionRule.java:
##########
@@ -75,6 +80,46 @@ protected void after() {
}
}
+ public ElasticConnectionModel getElasticConnectionModel() {
+ return elasticConnectionModel;
+ }
+
+ private void initializeElasticConnectionModel(String elasticConnectionString) {
+ try {
+ URI uri = new URI(elasticConnectionString);
+ String host = uri.getHost();
+ String scheme = uri.getScheme();
+ int port = uri.getPort();
+ String query = uri.getQuery();
+
+ String apiKey = null;
+ String apiSecret = null;
+ if (query != null) {
+ apiKey = query.split(",")[0].split("=")[1];
Review Comment:
As far as I understand, this assumes that the first parameter is always the API key, and the second always the secret... Example: "key=abc,secret=def". But if someone manually changes that to "secret=def,key=abc"?
What about using https://stackoverflow.com/questions/14768171/convert-string-representing-key-value-pairs-to-map to convert the key-value pair to a map and then retrieve the key and secret from the map?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org