hammock-project/hammock

Change default file.dir location

Closed this issue · 2 comments

Currently the default file.dir is set to /tmp this should be change because;

  • /tmp is full of temp files of other applications and is an potential security risk.
  • Not usefull as default, because the user always has to change it before using.
  • Might have issues under none-unix systems.

Possible defaults;

  • '.' current dir is still not sane default for users.
  • './static' in static folder by convention
  • '${file.base}/static' in static folder by convention in application root folder.

Where file.base defaults to '.'
This would make basic (default) application file structure like possible;
${file.base}/[config|log|static|data|backup|..]

There is work underway in pull #140 to apply changed default.

Right now, file.dir is only used by Jetty. But are you looking for a solution like https://github.com/hammock-project/hammock/wiki/Native-Filters#static-resources ?

I'm aiming for that per default /tmp is not exposed as static files.
Was reading;
https://github.com/hammock-project/hammock/wiki/ConfiguringYourApp
says;
file.dir - the location to read static files from - default /tmp
Ok, Looks like small change to make.
Ok, So no test for that, first write one.
Ok, Only works in jetty
Ok, Fix tomcat and undertow

But it need the reverse steps;

  • move file.dir to jetty prefixed config parameter
  • Change /tmp to '.'
  • Give tomcat its own parameter
  • Or else rename file.dir to like web-spi.work.dir and set to'.'
    And;
  • Make sure jetty is not hosting disk files per default from any location. (is this bug)
  • Still like the idea of file.base config to depend others from.
  • Update out-of-tree documentation or go in-tree.

Any thoughts ?