Skip to content

Commit

Permalink
Move /cache and /tmp to /WEB-INF folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Carsten Hollmann committed Mar 21, 2019
1 parent ceddcb7 commit 1642778
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ COPY --chown=jetty:jetty \
COPY --chown=jetty:jetty \
./docker/default-config /etc/sos

RUN ln -s /etc/sos /var/lib/jetty/webapps/ROOT/config
RUN ln -s /etc/sos /var/lib/jetty/webapps/ROOT/WEB-INF/config

VOLUME /var/lib/jetty/webapps/ROOT/tmp
VOLUME /var/lib/jetty/webapps/ROOT/WEB-INF/tmp
VOLUME /etc/sos

HEALTHCHECK --interval=5s --timeout=20s --retries=3 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public class SosContextListener implements ServletContextListener {

private static String path = null;
private static final List<Runnable> hooks = new LinkedList<>();
private static final String CONFIG = "config";
private static final String CONFIG_PATH = "config";
private static final String WEB_INF_PATH = "WEB-INF";

@Override
public void contextInitialized(ServletContextEvent sce) {
Expand Down Expand Up @@ -200,7 +201,7 @@ public static boolean hasPath() {
}

public static String getConfigPath() {
Path configPath = Paths.get(SosContextListener.path, CONFIG);
Path configPath = Paths.get(SosContextListener.path, WEB_INF_PATH, CONFIG_PATH);
if (Files.notExists(configPath)) {
try {
Files.createDirectories(configPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ protected String getBasePath() {
if (cacheFileFolder != null && cacheFileFolder.exists()) {
return cacheFileFolder.getAbsolutePath();
}
return Paths.get(SosContextListener.getPath(), "tmp").toString();
return Paths.get(SosContextListener.getPath(), "WEB-INF" , "tmp").toString();
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
<!-- location of the database configuration file -->
<context-param>
<param-name>datasourceConfigLocation</param-name>
<param-value>/config/datasource.properties</param-value>
<param-value>/WEB-INF/config/datasource.properties</param-value>
</context-param>
<!-- Memory leak preventer listener -->
<listener>
Expand Down

0 comments on commit 1642778

Please sign in to comment.