| | |
| | | // if the base folder dosen't match the default assume they don't want to use express, |
| | | // this allows for other containers to customise the basefolder per context. |
| | | String defaultBase = Constants.contextFolder$ + "/WEB-INF/data"; |
| | | String base = lookupBaseFolderFromJndi(); |
| | | String base = System.getProperty("GITBLIT_HOME",lookupBaseFolderFromJndi()); |
| | | if (!StringUtils.isEmpty(System.getenv("OPENSHIFT_DATA_DIR")) && defaultBase.equals(base)) { |
| | | // RedHat OpenShift |
| | | baseFolder = configureExpress(context, webxmlSettings, contextFolder, runtimeSettings); |
| | |
| | | runtime.getStatus().servletContainer = context.getServerInfo(); |
| | | runtime.start(); |
| | | managers.add(runtime); |
| | | |
| | | // create the plugin manager instance but do not start it |
| | | loadManager(injector, IPluginManager.class); |
| | | |
| | | // start all other managers |
| | | startManager(injector, INotificationManager.class); |
| | |
| | | return null; |
| | | } |
| | | |
| | | protected <X extends IManager> X startManager(ObjectGraph injector, Class<X> clazz) { |
| | | logManager(clazz); |
| | | protected <X extends IManager> X loadManager(ObjectGraph injector, Class<X> clazz) { |
| | | X x = injector.get(clazz); |
| | | return x; |
| | | } |
| | | |
| | | protected <X extends IManager> X startManager(ObjectGraph injector, Class<X> clazz) { |
| | | X x = loadManager(injector, clazz); |
| | | logManager(clazz); |
| | | x.start(); |
| | | managers.add(x); |
| | | return x; |
| | |
| | | } |
| | | } |
| | | |
| | | // Copy the included gitignore files to the configured gitignore folder |
| | | String gitignorePath = webxmlSettings.getString(Keys.git.gitignoreFolder, "gitignore"); |
| | | File localGitignores = com.gitblit.utils.FileUtils.resolveParameter(Constants.baseFolder$, base, gitignorePath); |
| | | if (!localGitignores.exists()) { |
| | | File warGitignores = new File(contextFolder, "/WEB-INF/data/gitignore"); |
| | | if (!warGitignores.equals(localGitignores)) { |
| | | try { |
| | | com.gitblit.utils.FileUtils.copy(localGitignores, warGitignores.listFiles()); |
| | | } catch (IOException e) { |
| | | logger.error(MessageFormat.format( |
| | | "Failed to copy included .gitignore files from {0} to {1}", |
| | | warGitignores, localGitignores)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // merge the WebXmlSettings into the runtime settings (for backwards-compatibilty) |
| | | runtimeSettings.merge(webxmlSettings); |
| | | |