Skip to content

Commit

Permalink
feat(conf): make docroot location configurable IQSS#9662
Browse files Browse the repository at this point in the history
Add JVM Setting and add to config checker on startup to ensure target location is in good shape.
  • Loading branch information
poikilotherm committed Jun 21, 2023
1 parent a4ec3a6 commit 6999093
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public void startup() {
public boolean checkSystemDirectories() {
Map<Path, String> paths = Map.of(
Path.of(JvmSettings.UPLOADS_DIRECTORY.lookup()), "temporary JSF upload space (see " + JvmSettings.UPLOADS_DIRECTORY.getScopedKey() + ")",
Path.of(FileUtil.getFilesTempDirectory()), "temporary processing space (see " + JvmSettings.FILES_DIRECTORY.getScopedKey() + ")");
Path.of(FileUtil.getFilesTempDirectory()), "temporary processing space (see " + JvmSettings.FILES_DIRECTORY.getScopedKey() + ")",
Path.of(JvmSettings.DOCROOT_DIRECTORY.lookup()), "docroot space (see " + JvmSettings.DOCROOT_DIRECTORY.getScopedKey() + ")");

boolean success = true;
for (Path path : paths.keySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public enum JvmSettings {
SCOPE_FILES(PREFIX, "files"),
FILES_DIRECTORY(SCOPE_FILES, "directory"),
UPLOADS_DIRECTORY(SCOPE_FILES, "uploads"),
DOCROOT_DIRECTORY(SCOPE_FILES, "docroot"),

// SOLR INDEX SETTINGS
SCOPE_SOLR(PREFIX, "solr"),
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/META-INF/microprofile-config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dataverse.files.directory=/tmp/dataverse
# been read yet! The names and their values are in sync here and over there to ensure the config checker
# is able to check for the directories (exist + writeable).
dataverse.files.uploads=${STORAGE_DIR:.}/uploads
dataverse.files.docroot=${STORAGE_DIR:.}/docroot

# SEARCH INDEX
dataverse.solr.host=localhost
Expand Down
8 changes: 4 additions & 4 deletions src/main/webapp/WEB-INF/glassfish-web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
</jsp-config>
<parameter-encoding default-charset="UTF-8"/>
<!-- Find a list of properties here: https://docs.oracle.com/cd/E19798-01/821-1750/beayb/index.html -->
<property name="alternatedocroot_1" value="from=/guides/* dir=./docroot"/>
<property name="alternatedocroot_2" value="from=/dataexplore/* dir=./docroot"/>
<property name="alternatedocroot_logos" value="from=/logos/* dir=./docroot"/>
<property name="alternatedocroot_sitemap" value="from=/sitemap/* dir=./docroot"/>
<property name="alternatedocroot_1" value="from=/guides/* dir=${MPCONFIG=dataverse.files.docroot:${ENV=STORAGE_DIR:.}/docroot}"/>
<property name="alternatedocroot_2" value="from=/dataexplore/* dir=${MPCONFIG=dataverse.files.docroot:${ENV=STORAGE_DIR:.}/docroot}"/>
<property name="alternatedocroot_logos" value="from=/logos/* dir=${MPCONFIG=dataverse.files.docroot:${ENV=STORAGE_DIR:.}/docroot}"/>
<property name="alternatedocroot_sitemap" value="from=/sitemap/* dir=${MPCONFIG=dataverse.files.docroot:${ENV=STORAGE_DIR:.}/docroot}"/>
<!--
This folder is not only holding compiled JSP pages but also the place where file streams are stored
during uploads. As Dataverse does not use any JSP, there will only be uploads stored here.
Expand Down

0 comments on commit 6999093

Please sign in to comment.