Skip to content

Commit 8a982d8

Browse files
committed
Add translationServiceEnabled field to config depending on application properties
1 parent 52591c7 commit 8a982d8

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/main/java/org/wise/portal/presentation/web/controllers/author/project/AuthorAPIController.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ protected HashMap<String, Object> getAuthorProjectConfig(Authentication auth,
400400
config.put("projectBaseURL", projectBaseURL);
401401
config.put("previewProjectURL", contextPath + "/preview/unit/" + project.getId());
402402
config.put("chatGptEnabled", !StringUtils.isEmpty(appProperties.getProperty("OPENAI_API_KEY")));
403+
config.put("translationServiceEnabled", this.awsPropertiesConfigured());
403404
config.put("cRaterRequestURL", contextPath + "/api/c-rater");
404405
config.put("importStepsURL",
405406
contextPath + "/api/author/project/importSteps/" + project.getId());
@@ -424,6 +425,12 @@ protected HashMap<String, Object> getAuthorProjectConfig(Authentication auth,
424425
return config;
425426
}
426427

428+
private boolean awsPropertiesConfigured() {
429+
return !(StringUtils.isEmpty(appProperties.getProperty("aws.accessKeyId"))
430+
|| StringUtils.isEmpty(appProperties.getProperty("aws.secretAccessKey"))
431+
|| StringUtils.isEmpty(appProperties.getProperty("aws.region")));
432+
}
433+
427434
/**
428435
* Get the run that uses the project id
429436
*

0 commit comments

Comments
 (0)