Skip to content

Commit

Permalink
BAH-4093 | Add. Default value for config file path property. (#80)
Browse files Browse the repository at this point in the history
* BAH-4093 | Add. Default value for config file path property.

* BAH-4093 | Refactor. Update property name
  • Loading branch information
mohan-13 authored Sep 4, 2024
1 parent 90b21fb commit 4e42e9f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public class ConfigLoader {

private ObjectMapper objectMapper = new ObjectMapper();

@Value("${config-file.path}")
private String routeConfigurationFileLocation;
@Value("${ipd.events_config.file_path:/etc/bahmni_config/openmrs/apps/ipdDashboard/eventsConfig.json}")
private String eventsConfigurationFileLocation;

public List<ConfigDetail> getConfigs() {
if (configs.isEmpty()) {
Expand All @@ -32,10 +32,10 @@ public List<ConfigDetail> getConfigs() {

private void loadConfiguration() {
try {
File routeConfigurationFile = new FileSystemResource(routeConfigurationFileLocation).getFile();
File routeConfigurationFile = new FileSystemResource(eventsConfigurationFileLocation).getFile();
this.configs = objectMapper.readValue(routeConfigurationFile, new TypeReference<List<ConfigDetail>>() {});
} catch (IOException exception) {
log.error("Failed to load configuration for file : " + routeConfigurationFileLocation, exception);
log.error("Failed to load configuration for file : " + eventsConfigurationFileLocation, exception);
}
}
}
2 changes: 1 addition & 1 deletion api/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

# Route definitions
config-file.path=/etc/bahmni_config/openmrs/apps/ipdDashboard/eventsConfig.json
ipd.events_config.file_path=/etc/bahmni_config/openmrs/apps/ipdDashboard/eventsConfig.json

0 comments on commit 4e42e9f

Please sign in to comment.