(refs #204)Add some way to configure data directory.

1) system property of JVM (e.g. -Dgitbucket.home=PATH_TO_DATADIR)
2) java -jar gitbucket.war --data=PATH_TO_DATADIR
3) Add context parameter "gitbucket.home" to web.xml
This commit is contained in:
takezoe
2013-11-30 05:18:15 +09:00
parent bbff75e037
commit b3669f6d66
4 changed files with 27 additions and 27 deletions

View File

@@ -8,9 +8,15 @@ import util.ControlUtil._
*/
object Directory {
val GitBucketHome = (scala.util.Properties.envOrNone("GITBUCKET_HOME") match {
case Some(env) => new File(env)
case None => new File(System.getProperty("user.home"), "gitbucket")
val GitBucketHome = (System.getProperty("gitbucket.home") match {
// -Dgitbucket.home=<path>
case path if(path != null) => new File(path)
case _ => scala.util.Properties.envOrNone("GITBUCKET_HOME") match {
// environment variable GITBUCKET_HOME
case Some(env) => new File(env)
// default is HOME/gitbucket
case None => new File(System.getProperty("user.home"), "gitbucket")
}
}).getAbsolutePath
val GitBucketConf = new File(GitBucketHome, "gitbucket.conf")