Skip to content

Commit ec7cca2

Browse files
committed
XCOMMONS-3289: Allow overwritting xwiki.properties and xwiki.cfg properties via environment variable and Java system properties
* improve documentation
1 parent 00d236d commit ec7cca2

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

xwiki-commons-core/xwiki-commons-configuration/xwiki-commons-configuration-default/src/main/java/org/xwiki/configuration/internal/SystemEnvConfigurationSource.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,13 @@
3232
/**
3333
* Environment variables based configuration source.
3434
* <p>
35-
* Environment variable are expected to be prefixed with XCONF_ to be taken into account by this
35+
* Environment variable are expected to be prefixed with {@code XCONF_} to be taken into account by this
3636
* {@link ConfigurationSource}. Also, to support all systems, we cannot expect environment variable to allow anything
37-
* else than [a-zA-Z_]+[a-zA-Z0-9_]* so we apply the following encoding:
37+
* else than {@code [a-zA-Z_]+[a-zA-Z0-9_]*} so we apply the following encoding:
3838
* <ul>
39-
* <li>., : and - (don’t hesitate if you think of something else that might be common in a configuration file key) are
40-
* converted to _</li>
41-
* <li>_ remains _</li>
42-
* <li>any other forbidden character is converted to _<UTF8, URL style, code></li>
39+
* <li>{@code .}, {@code :} and {@code -} are converted to {@code _}</li>
40+
* <li>{@code _} remains {@code _}</li>
41+
* <li>any other forbidden character is converted to {@code _<UTF8, URL style, code>}</li>
4342
* </ul>
4443
* <p>
4544
* For example the {@link ConfigurationSource} property key "configuration.1Key@" will lead the the environment variable

xwiki-commons-core/xwiki-commons-configuration/xwiki-commons-configuration-default/src/main/java/org/xwiki/configuration/internal/SystemPropertiesConfigurationSource.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,17 @@
2828

2929
import org.xwiki.component.annotation.Component;
3030
import org.xwiki.configuration.ConfigurationSaveException;
31+
import org.xwiki.configuration.ConfigurationSource;
3132

3233
/**
3334
* {@link System} properties based configuration source.
34-
*
35+
* <p>
36+
* System properties are expected to be prefixed with {@code xconf_} to be taken into account by this
37+
* {@link org.xwiki.configuration.ConfigurationSource}.
38+
* <p>
39+
* For example the {@link ConfigurationSource} property key "configuration.key" will lead the the environment variable
40+
* "xconf.configuration.key".
41+
*
3542
* @version $Id$
3643
* @since 17.4.0RC1
3744
*/

0 commit comments

Comments
 (0)