mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 13:35:50 +01:00
Create GitBucketHome on boot if it does not exist.
This commit is contained in:
@@ -1,10 +1,21 @@
|
||||
import app._
|
||||
import org.scalatra._
|
||||
import javax.servlet.ServletContext
|
||||
import javax.servlet._
|
||||
|
||||
class ScalatraBootstrap extends LifeCycle {
|
||||
override def init(context: ServletContext) {
|
||||
context.mount(new CreateRepositoryServlet, "/new")
|
||||
context.mount(new RepositoryViewerServlet, "/*")
|
||||
|
||||
context.addListener(new ServletContextListener(){
|
||||
def contextInitialized(e: ServletContextEvent): Unit = {
|
||||
val dir = new java.io.File(_root_.util.Directory.GitBucketHome)
|
||||
if(!dir.exists){
|
||||
dir.mkdirs()
|
||||
}
|
||||
}
|
||||
|
||||
def contextDestroyed(e: ServletContextEvent): Unit = {}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user