Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BAH-4093 | Add. Default value for config file path property. #80

Merged
merged 2 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading