Hi devs,

Context
======

Clemens fixed a bug at https://jira.xwiki.org/browse/XWIKI-15163 and while 
doing so inroduced a new system property to override the location of the 
xwiki.properties file. I commented at 
https://jira.xwiki.org/browse/XWIKI-15163?focusedCommentId=98075&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-98075

Even though it’s not necessary to introduce a new system property just for the 
need of this test (it’s easy to refactor the code to not need this IMO), it 
raises the question of what we want to do to make the configuration simpler in 
XWiki (simpler config, simpler upgrades, etc).

History
======

We discussed this a few times in the past:

* March 2010: http://markmail.org/message/6cvm5hocvtbqtgp6
* June 2012: https://markmail.org/message/3aq2bjrb6a2ip2ri

Note that the June 2012 proposal was agreed.

Globally this is what we implemented since the June 2012 proposal:

* XCOMMONS-187: The Permanent Data directory resolver should support System 
Property "xwiki.data.dir". More specifically the code is here: 
https://github.com/xwiki/xwiki-commons/blob/55569d3466dc0ea36f6964474973f7ad19f2929e/xwiki-commons-core/xwiki-commons-environment/xwiki-commons-environment-common/src/main/java/org/xwiki/environment/internal/AbstractEnvironment.java#L107
* XWIKI-13867: Search xwiki.cfg in /etc/xwiki/ first. Code is here: 
https://github.com/xwiki/xwiki-platform/blob/973d4e9c6ad02dbb31d94fe96df9c164b0d7d516/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/internal/XWikiCfgConfigurationSource.java#L90
* XWIKI-13868: Search xwiki.properties in /etc/xwiki/ first. Code is here: 
https://github.com/xwiki/xwiki-platform/blob/93f02215783ac0f4030fe3062cac4dd094b64383/xwiki-platform-core/xwiki-platform-configuration/xwiki-platform-configuration-default/src/main/java/org/xwiki/configuration/internal/XWikiPropertiesConfigurationSource.java#L78

I’d like to note that I don’t remember discussions/proposals for 
XWIKI-13867/XWIKI-13868 and I commented on 
http://jira.xwiki.org/browse/XWIKI-13867 and didn’t get any response from my 
various comments.

Current behavior
=============

So right now the behavior is the following on config files (I’m excluding the 
recent change of Clements, see below in actions):

* If xwiki.cfg exists under the. "java:comp/env” JNDI key, then it’s used
* If not found, then search for it in /etc/xwiki/xwiki.cfg
* If not found, then default to WEB-INF/xwiki.cfg

* If /etc/xwiki.xwiki.properties exist then it’s used
* if not found, search in WEB-INF/xwiki.properties (as a ServletContext 
resource)
* If not found, then default to an empty configuration

Discussion/Proposal
================

* I think we should ask Clemens to rollback the introduction of the 
xwiki.properties.default.dir system property and to just make the test work 
without introducing any system property. I can help Clemens do that.
* I propose that instead we continue implementing the June 2012 proposal 
defined at https://markmail.org/message/3aq2bjrb6a2ip2ri and introduce the 
xwiki.config.dir system property.
* Right now I don’t like the solution introduced by /etc/xwiki/* because they 
don’t allow supporting several instances of XWiki on the same machine. However, 
the introduction of xwiki.config.dir system property would fix it.
* We could also introduce the user home dir location as a location where xwiki 
config files would be looked for.
* We also need to generalize the config files to hibernate.cfg.xml and 
clustering config files (jgroup files), and logback. See 
https://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/Backup#HConfigurationfiles

WDYT?

Thanks
-Vincent

PS: Sorry for the long mail, I had to do a lot of archeology to research this… 
Took me a while ;)










Reply via email to