summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/GitBlit.java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2013-10-02 17:12:18 -0400
committerJames Moger <james.moger@gitblit.com>2013-10-02 17:12:18 -0400
commit06718be43c345d74f24288d7b8477d2237ce7358 (patch)
treebbef87d2effb92123b14abe9c26cdca3602f8804 /src/main/java/com/gitblit/GitBlit.java
parent31f305c2c9d1737dbcd4e3cac051cceb31d1cb1e (diff)
downloadgitblit-06718be43c345d74f24288d7b8477d2237ce7358.tar.gz
gitblit-06718be43c345d74f24288d7b8477d2237ce7358.zip
Switch web.xml baseFolder from context-param to env-entry
Change-Id: Id18077126e984a767725cf9e8d8eb531a14e1713
Diffstat (limited to 'src/main/java/com/gitblit/GitBlit.java')
-rw-r--r--src/main/java/com/gitblit/GitBlit.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/com/gitblit/GitBlit.java b/src/main/java/com/gitblit/GitBlit.java
index 5eec7a93..7f82432d 100644
--- a/src/main/java/com/gitblit/GitBlit.java
+++ b/src/main/java/com/gitblit/GitBlit.java
@@ -62,6 +62,9 @@ import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMultipart;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
@@ -3776,6 +3779,18 @@ public class GitBlit implements ServletContextListener {
logger.error("");
}
+ try {
+ // try to lookup JNDI env-entry for the baseFolder
+ InitialContext ic = new InitialContext();
+ Context env = (Context) ic.lookup("java:comp/env");
+ String val = (String) env.lookup("baseFolder");
+ if (!StringUtils.isEmpty(val)) {
+ path = val;
+ }
+ } catch (NamingException n) {
+ logger.error("Failed to get JNDI env-entry: " + n.getExplanation());
+ }
+
File base = com.gitblit.utils.FileUtils.resolveParameter(Constants.contextFolder$, contextFolder, path);
base.mkdirs();