Skip to content

Commit

Permalink
refactor(settings): use new JvmSettings.lookup() IQSS#7000
Browse files Browse the repository at this point in the history
  • Loading branch information
poikilotherm committed Jun 22, 2022
1 parent 561c965 commit 983e49f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ public class IndexServiceBean {

@PostConstruct
public void init() {
String protocol = config.getValue(JvmSettings.SOLR_PROT.getScopedKey(), String.class);
String path = config.getValue(JvmSettings.SOLR_PATH.getScopedKey(), String.class);
String protocol = JvmSettings.SOLR_PROT.lookup();
String path = JvmSettings.SOLR_PATH.lookup();

String urlString = protocol + "://" + systemConfig.getSolrHostColonPort() + path;
solrServer = new HttpSolrClient.Builder(urlString).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public class SolrClientService {

@PostConstruct
public void init() {
String protocol = config.getValue(JvmSettings.SOLR_PROT.getScopedKey(), String.class);
String path = config.getValue(JvmSettings.SOLR_PATH.getScopedKey(), String.class);
String protocol = JvmSettings.SOLR_PROT.lookup();
String path = JvmSettings.SOLR_PATH.lookup();

String urlString = protocol + "://" + systemConfig.getSolrHostColonPort() + path;
solrClient = new HttpSolrClient.Builder(urlString).build();
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public String getVersion(boolean withBuildNumber) {
// which contains in the source a Maven property reference to ${project.version}.
// When packaging the app to deploy it, Maven will replace this, rendering it a static entry.
// NOTE: MicroProfile Config will cache the entry for us in internal maps.
String appVersion = config.getValue(JvmSettings.VERSION.getScopedKey(), String.class);
String appVersion = JvmSettings.VERSION.lookup();

if (withBuildNumber) {
if (buildNumber == null) {
Expand All @@ -145,7 +145,7 @@ public String getVersion(boolean withBuildNumber) {
// Also try to read the build number via MicroProfile Config if not already present from the
// properties file (so can be overridden by env var or other source)
if (buildNumber == null || buildNumber.isEmpty()) {
buildNumber = config.getOptionalValue(JvmSettings.BUILD.getScopedKey(), String.class).orElse("");
buildNumber = JvmSettings.BUILD.lookupOptional().orElse("");
}
}

Expand All @@ -172,8 +172,8 @@ public String getSolrHostColonPort() {
// Get from MPCONFIG. Might be configured by a sysadmin or simply return the default shipped with
// resources/META-INF/microprofile-config.properties.
// NOTE: containers should use system property mp.config.profile=ct to use sane container usage default
String host = config.getValue(JvmSettings.SOLR_HOST.getScopedKey(), String.class);
String port = config.getValue(JvmSettings.SOLR_PORT.getScopedKey(), String.class);
String host = JvmSettings.SOLR_HOST.lookup();
String port = JvmSettings.SOLR_PORT.lookup();

// DB setting takes precedence over all. If not present, will return default from above.
return Optional.ofNullable(settingsService.getValueForKey(SettingsServiceBean.Key.SolrHostColonPort))
Expand Down

0 comments on commit 983e49f

Please sign in to comment.