Skip to content

Commit

Permalink
Use es.sign.requests property/Env var to enable AWS signed request, d…
Browse files Browse the repository at this point in the history
…efault is enabled.
  • Loading branch information
n2iw committed Jan 27, 2022
1 parent 0d6bb77 commit 13cc3ec
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/main/java/gov/nih/nci/bento/model/ConfigurationDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ public void setEsSchemaFile(String esSchemaFile) {
@Value("${es.scheme}")
private String esScheme;

public boolean getEsSignRequests() {
return esSignRequests;
}

public void setEsSignRequests(boolean esSignRequests) {
this.esSignRequests = esSignRequests;
}

@Value("${es.sign.requests:true}")
private boolean esSignRequests;


public int getEsPort() {
return esPort;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gov/nih/nci/bento/service/ESService.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public RestClient searchClient(String serviceName, String region) {
String host = config.getEsHost().trim();
String scheme = config.getEsScheme();
int port = config.getEsPort();
if (host.contains("amazonaws.com")) {
if (config.getEsSignRequests()) {
AWS4Signer signer = new AWS4Signer();
signer.setServiceName(serviceName);
signer.setRegionName(region);
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/application.properties.j2
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ redis.ttl=-1
es.port = 443
es.scheme = https
es.filter.enabled = true
# use es.sign.requests = true if running AWS OpenSearch
es.sign.requests = true

#Testing
test.queries_file = yaml/{{test_queries_file}}
2 changes: 2 additions & 0 deletions src/main/resources/application_example.properties
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ es.host = localhost
es.port = 9200
es.scheme = http
es.filter.enabled = true
# use es.sign.requests = true if running AWS OpenSearch
es.sign.requests = false

#Testing
test.queries_file=yaml/test-queries.example.yaml
Expand Down

0 comments on commit 13cc3ec

Please sign in to comment.