diff --git a/Dockerfile b/Dockerfile
index 47053d0ea289201cd6c3010d2b576399aaec3fa4..451b9c74ca89f08879750231cb0c7d258dd22e23 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,8 +1,27 @@
+# ---------------------------------------------------------------------------
+# See the NOTICE file distributed with this work for additional
+# information regarding copyright ownership.
+#
+# This is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+# ---------------------------------------------------------------------------
 FROM debian:jessie
 
 MAINTAINER Vincent Massol <vincent@massol.net>
 
-# Note: when using docker-compose, the values are overridden from the .enf file.
+# Note: when using docker-compose, these values are overridden from the .env file.
 ENV XWIKI_VERSION=8.4.4 \
     MYSQL_DRIVER_VERSION=5.1.38 \
     MYSQL_USER=xwiki \
@@ -21,13 +40,11 @@ RUN rm -rf /var/lib/tomcat8/webapps/* && \
   unzip -d /var/lib/tomcat8/webapps/ROOT xwiki.war && \
   rm -f xwiki.war
 
-# Set a specific distribution id
-RUN sed "s/<id>org.xwiki.enterprise:xwiki-enterprise-web/<id>org.xwiki.enterprise:xwiki-enterprise-docker/" < /var/lib/tomcat8/webapps/ROOT/META-INF/extension.xed > /var/lib/tomcat8/webapps/ROOT/META-INF/extension2.xed && \
-  mv /var/lib/tomcat8/webapps/ROOT/META-INF/extension2.xed /var/lib/tomcat8/webapps/ROOT/META-INF/extension.xed
-
 # Download the MySQL JDBC driver and install it in the XWiki webapp
-RUN curl -L https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-${MYSQL_DRIVER_VERSION}.tar.gz -o mysql-connector-java-${MYSQL_DRIVER_VERSION}.tar.gz && \
-  tar xvf mysql-connector-java-${MYSQL_DRIVER_VERSION}.tar.gz mysql-connector-java-${MYSQL_DRIVER_VERSION}/mysql-connector-java-${MYSQL_DRIVER_VERSION}-bin.jar -O > \
+RUN curl -L https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-${MYSQL_DRIVER_VERSION}.tar.gz \
+    -o mysql-connector-java-${MYSQL_DRIVER_VERSION}.tar.gz && \
+  tar xvf mysql-connector-java-${MYSQL_DRIVER_VERSION}.tar.gz \
+    mysql-connector-java-${MYSQL_DRIVER_VERSION}/mysql-connector-java-${MYSQL_DRIVER_VERSION}-bin.jar -O > \
     /var/lib/tomcat8/webapps/ROOT/WEB-INF/lib/mysql-connector-java-${MYSQL_DRIVER_VERSION}-bin.jar && \
   rm -f mysql-connector-java-${MYSQL_DRIVER_VERSION}.tar.gz
 
@@ -43,11 +60,45 @@ COPY xwiki/hibernate.cfg.xml /var/lib/tomcat8/webapps/ROOT/WEB-INF/hibernate.cfg
 # Configure the XWiki permanent directory
 RUN mkdir -p /var/lib/xwiki
 
-# Make the XWiki permanent directory not be recreated across runs
-VOLUME /var/lib/xwiki
+# Set a specific distribution id in XWiki for this docker packaging.
+RUN sed "s/<id>org.xwiki.enterprise:xwiki-enterprise-web/<id>org.xwiki.enterprise:xwiki-enterprise-docker/" \
+    < /var/lib/tomcat8/webapps/ROOT/META-INF/extension.xed > /var/lib/tomcat8/webapps/ROOT/META-INF/extension2.xed && \
+  mv /var/lib/tomcat8/webapps/ROOT/META-INF/extension2.xed /var/lib/tomcat8/webapps/ROOT/META-INF/extension.xed
 
 # Set ownership and permission to the tomcat8 user
-RUN chown -R tomcat8:tomcat8 /var/lib/xwiki /var/lib/tomcat8
+RUN chown -R tomcat8:tomcat8 /var/lib/xwiki
+RUN chown -R tomcat8:tomcat8 /var/lib/tomcat8
+
+# Add scripts required to make changes to XWiki configuration files at execution time
+COPY xwiki/xwiki-config-replace.sh /usr/local/bin/xwiki-config-replace.sh
+COPY xwiki/xwiki-set-cfg /usr/local/bin/xwiki-set-cfg
+COPY xwiki/xwiki-set-properties /usr/local/bin/xwiki-set-properties
+COPY xwiki/start_xwiki.sh /usr/local/bin/start_xwiki.sh
+RUN chmod 0755 /usr/local/bin/xwiki-config-replace.sh /usr/local/bin/xwiki-set-cfg /usr/local/bin/xwiki-set-properties \
+  /usr/local/bin/start_xwiki.sh
+
+# Make the XWiki permanent directory persist on the host (so that it's not recreated across runs)
+VOLUME /var/lib/xwiki
+
+# Expose the Tomcat port
+EXPOSE 8080
+
+# At this point the image is done and what remains below are the runtime configuration used by the user to configure
+# the container that will be created out of the image. Namely the user can override some environment variables with
+#   docker run -e "var1=val1" -e "var2=val2" ...
+# The supported environment variables that can be overridden are:
+# - MYSQL_USER: the name of the user configured for XWiki in the DB. Default is "xwiki". This is used to configure
+#               xwiki's hibernate.cfg.xml file.
+# - MYSQL_PASSWORD: the password for the user configured for XWiki in the DB. Default is "xwiki". This is used to
+#                   configure xwiki's hibernate.cfg.xml file.
+# Example:
+#   docker run -it -e "MYSQL_USER=xwiki" -e "MYSQL_PASSWORD=xwiki" <imagename>
+
+# Starts XWiki by starting Tomcat. All options passed to "docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...]"
+# are also passed to start_xwiki.sh. However at the moment start_xwiki.sh doesn't support any parameters and all
+# configurations are done through environment variable overrides (see above).
+ENTRYPOINT ["start_xwiki.sh"]
 
-# Start Tomcat with the tomcat8 user (created by apt-get tomcat8)
-CMD sudo -u tomcat8 /usr/share/tomcat8/bin/catalina.sh run
+# When no options are passed on the "docker run" command line we display a message explaining what environment
+# variables can be overridden.
+CMD ["--info"]
diff --git a/docker-compose.yml b/docker-compose.yml
index f941105df9e5300e75e5733544db9fe21faed80c..d529427f887873eb7322bf5f289bafab7f8b6555 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,3 +1,22 @@
+# ---------------------------------------------------------------------------
+# See the NOTICE file distributed with this work for additional
+# information regarding copyright ownership.
+#
+# This is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+# ---------------------------------------------------------------------------
 version: '2'
 services:
   # The container that runs XWiki + Tomcat
@@ -22,7 +41,7 @@ services:
   # The container that runs MySQL
   db:
     image: "mysql:5"
-    # - We provide a xwiki.cfn file in order to configure the mysql db to support UTF8 and be case-insensitive
+    # - We provide a xwiki.cnf file in order to configure the mysql db to support UTF8 and be case-insensitive
     # We have to do it here since we use an existing image and that's how this image allows customizations.
     # See https://hub.docker.com/_/mysql/ for more details.
     # - Provide a name instead of an auto-generated id for the mysql data, to make it simpler to identify in
diff --git a/files/hibernate.cfg.xml b/files/hibernate.cfg.xml
deleted file mode 100644
index 0121864f59a13c656d16603dbc77c4768a558cac..0000000000000000000000000000000000000000
--- a/files/hibernate.cfg.xml
+++ /dev/null
@@ -1,209 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- * See the NOTICE file distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
--->
-
-<!DOCTYPE hibernate-configuration PUBLIC
-  "-//Hibernate/Hibernate Configuration DTD//EN"
-  "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
-<hibernate-configuration>
-  <session-factory>
-
-    <!-- Please refer to the installation guide on
-         http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Installation for configuring your
-         database. You'll need to do 2 things:
-         1) Copy your database driver JAR in WEB-INF/lib or in some shared lib directory
-         2) Uncomment the properties below for your specific DB (and comment the default
-            database configuration if it doesn't match your DB)
-    -->
-
-    <!-- Generic parameters common to all Databases -->
-
-    <property name="show_sql">false</property>
-    <property name="use_outer_join">true</property>
-
-    <property name="connection.pool_size">2</property>
-    <property name="statement_cache.size">2</property>
-
-    <!-- Without it, some queries fail in MS SQL. XWiki doesn't need scrollable result sets, anyway. -->
-    <property name="jdbc.use_scrollable_resultset">false</property>
-
-    <!-- DBCP Connection Pooling configuration. Only some properties are shown. All available properties can be found
-         at http://commons.apache.org/proper/commons-dbcp/configuration.html
-    -->
-    <property name="dbcp.defaultAutoCommit">false</property>
-    <property name="dbcp.maxTotal">50</property>
-    <property name="dbcp.maxIdle">5</property>
-    <property name="dbcp.maxWaitMillis">30000</property>
-    <property name="connection.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property>
-
-    <!-- Setting "dbcp.poolPreparedStatements" to true and "dbcp.maxOpenPreparedStatements" will tell DBCP to cache
-         Prepared Statements (it's off by default). Note that for backward compatibility the "dbcp.ps.maxActive" is also
-         supported and when set it'll set "dbcp.poolPreparedStatements" to true and "dbcp.maxOpenPreparedStatements" to
-         value of "dbcp.ps.maxActive".
-
-         Note 1: When using HSQLDB for example, it's important to NOT cache prepared statements because HSQLDB
-         Prepared Statements (PS) contain the schema on which they were initially created and thus when switching
-         schema if the same PS is reused it'll execute on the wrong schema! Since HSQLDB does internally cache
-         prepared statement there's no performance loss by not caching Prepared Statements at the DBCP level.
-         See http://jira.xwiki.org/browse/XWIKI-1740.
-         Thus we recommend not turning on this configuration for HSQLDB unless you know what you're doing :)
-
-         Note 2: The same applies to PostGreSQL.
-    -->
-
-    <!-- BoneCP Connection Pooling configuration.
-    <property name="bonecp.idleMaxAgeInMinutes">240</property>
-    <property name="bonecp.idleConnectionTestPeriodInMinutes">60</property>
-    <property name="bonecp.partitionCount">3</property>
-    <property name="bonecp.acquireIncrement">10</property>
-    <property name="bonecp.maxConnectionsPerPartition">60</property>
-    <property name="bonecp.minConnectionsPerPartition">20</property>
-    <property name="bonecp.statementsCacheSize">50</property>
-    <property name="bonecp.releaseHelperThreads">3</property>
-    <property name="connection.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property>
-    -->
-
-
-    <!-- Configuration for the default database.
-         Comment out this section and uncomment other sections below if you want to use another database.
-         Note that the database tables will be created automatically if they don't already exist.
-    <property name="connection.url">jdbc:hsqldb:file:${environment.permanentDirectory}/database/xwiki_db;shutdown=true</property>
-    <property name="connection.username">sa</property>
-    <property name="connection.password"></property>
-    <property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
-    <property name="dialect">org.hibernate.dialect.HSQLDialect</property>
-
-    <mapping resource="xwiki.hbm.xml"/>
-    <mapping resource="feeds.hbm.xml"/>
-    <mapping resource="activitystream.hbm.xml"/>
-    <mapping resource="instance.hbm.xml"/>
-    <mapping resource="mailsender.hbm.xml"/> -->
-
-    <!-- MySQL configuration.
-         Uncomment if you want to use MySQL and comment out other database configurations.-->
-
-    <property name="connection.url">jdbc:mysql://localhost/xwiki</property>
-    <property name="connection.username">xwiki</property>
-    <property name="connection.password">xwiki</property>
-    <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
-    <property name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
-    <property name="dbcp.poolPreparedStatements">true</property>
-    <property name="dbcp.maxOpenPreparedStatements">20</property>
-    <mapping resource="xwiki.hbm.xml"/>
-    <mapping resource="feeds.hbm.xml"/>
-    <mapping resource="activitystream.hbm.xml"/>
-    <mapping resource="instance.hbm.xml"/>
-    <mapping resource="mailsender.hbm.xml"/>
-
-    <!-- HSQLDB configuration.
-         Uncomment if you want to use HSQLDB and comment out other database configurations.
-
-    <property name="connection.url">jdbc:hsqldb:file:${environment.permanentDirectory}/database/xwiki_db;shutdown=true</property>
-    <property name="connection.username">sa</property>
-    <property name="connection.password"></property>
-    <property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
-    <property name="dialect">org.hibernate.dialect.HSQLDialect</property>
-    <mapping resource="xwiki.hbm.xml"/>
-    <mapping resource="feeds.hbm.xml"/>
-    <mapping resource="activitystream.hbm.xml"/>
-    <mapping resource="instance.hbm.xml"/>
-    <mapping resource="mailsender.hbm.xml"/>
-    -->
-
-    <!-- PostgreSQL configuration.
-         Uncomment if you want to use PostgreSQL and comment out other database configurations.
-         Notes:
-           - "jdbc.use_streams_for_binary" needs to be set to "false",
-             see https://community.jboss.org/wiki/HibernateCoreMigrationGuide36
-           - "xwiki.virtual_mode" can be set to either "schema" or "database". Note that currently the database mode
-             doesn't support database creation (see http://jira.xwiki.org/browse/XWIKI-8753)
-
-    <property name="connection.url">jdbc:postgresql:xwiki</property>
-    <property name="connection.username">xwiki</property>
-    <property name="connection.password">xwiki</property>
-    <property name="connection.driver_class">org.postgresql.Driver</property>
-    <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
-    <property name="jdbc.use_streams_for_binary">false</property>
-    <property name="xwiki.virtual_mode">schema</property>
-    <mapping resource="xwiki.postgresql.hbm.xml"/>
-    <mapping resource="feeds.hbm.xml"/>
-    <mapping resource="activitystream.hbm.xml"/>
-    <mapping resource="instance.hbm.xml"/>
-    <mapping resource="mailsender.hbm.xml"/>
-    -->
-
-    <!-- Oracle configuration.
-         Uncomment if you want to use Oracle and comment out other database configurations.
-         Notes:
-           - the 2 properties named "connection.SetBigStringTryClob" and
-             "jdbc.batch_size" are required to tell Oracle to allow CLOBs larger than 32K.
-           - "jdbc.use_streams_for_binary" needs to be set to "false",
-             see https://community.jboss.org/wiki/HibernateCoreMigrationGuide36
-
-    <property name="connection.url">jdbc:oracle:thin:@localhost:1521:XE</property>
-    <property name="connection.username">xwiki</property>
-    <property name="connection.password">xwiki</property>
-    <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
-    <property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
-    <property name="connection.SetBigStringTryClob">true</property>
-    <property name="jdbc.batch_size">0</property>
-    <property name="jdbc.use_streams_for_binary">false</property>
-    <property name="dbcp.poolPreparedStatements">true</property>
-    <property name="dbcp.maxOpenPreparedStatements">20</property>
-    <mapping resource="xwiki.oracle.hbm.xml"/>
-    <mapping resource="feeds.oracle.hbm.xml"/>
-    <mapping resource="activitystream.hbm.xml"/>
-    <mapping resource="instance.hbm.xml"/>
-    <mapping resource="mailsender.oracle.hbm.xml"/>
-    -->
-
-    <!-- Derby configuration.
-         Uncomment if you want to use Derby and comment out other database configurations.
-
-    <property name="connection.url">jdbc:derby:/some/path/xwikidb;create=true</property>
-    <property name="connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property>
-    <property name="dialect">org.hibernate.dialect.DerbyDialect</property>
-    <property name="dbcp.poolPreparedStatements">true</property>
-    <property name="dbcp.maxOpenPreparedStatements">20</property>
-    <mapping resource="xwiki.derby.hbm.xml"/>
-    <mapping resource="feeds.hbm.xml"/>
-    <mapping resource="activitystream.hbm.xml"/>
-    <mapping resource="instance.hbm.xml"/>
-    <mapping resource="mailsender.hbm.xml"/>
-    -->
-
-    <!-- H2 configuration.
-         Uncomment if you want to use H2 and comment out other database configurations.
-
-    <property name="connection.url">jdbc:h2:${environment.permanentDirectory}/database/xwiki</property>
-    <property name="connection.username">sa</property>
-    <property name="connection.password"></property>
-    <property name="connection.driver_class">org.h2.Driver</property>
-    <property name="dialect">org.hibernate.dialect.H2Dialect</property>
-    <mapping resource="xwiki.hbm.xml"/>
-    <mapping resource="feeds.hbm.xml"/>
-    <mapping resource="activitystream.hbm.xml"/>
-    <mapping resource="instance.hbm.xml"/>
-    <mapping resource="mailsender.hbm.xml"/>
-    -->
-
-  </session-factory>
-</hibernate-configuration>
diff --git a/files/start_xwiki.sh b/files/start_xwiki.sh
deleted file mode 100755
index 539947057809d8934d63aaccbb2524950d8a7000..0000000000000000000000000000000000000000
--- a/files/start_xwiki.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-if [ "$(ls -A /var/lib/mysql)" == "" ]; then
-  /usr/bin/mysql_install_db || exit 1;
-fi
-
-/etc/init.d/mysql start || exit 1;
-
-if ! mysql -u root -e "show databases" | grep xwiki; then
-  mysql -u root -e "create database xwiki default character set utf8 collate utf8_bin"
-  mysql -u root -e "grant all privileges on *.* to xwiki@localhost identified by 'xwiki'"
-fi
-
-export CATALINA_HOME=/usr/share/tomcat7
-export CATALINA_BASE=/var/lib/tomcat7
-export CATALINA_OPTS="-Xmx800m -XX:MaxPermSize=192m"
-
-$CATALINA_HOME/bin/catalina.sh run
-
-
diff --git a/files/xwiki.properties b/files/xwiki.properties
deleted file mode 100644
index a1244099191c321355efd63a4dd16a58a90b3c37..0000000000000000000000000000000000000000
--- a/files/xwiki.properties
+++ /dev/null
@@ -1,724 +0,0 @@
-# ---------------------------------------------------------------------------
-# See the NOTICE file distributed with this work for additional
-# information regarding copyright ownership.
-#
-# This is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2.1 of
-# the License, or (at your option) any later version.
-#
-# This software is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this software; if not, write to the Free
-# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-# ---------------------------------------------------------------------------
-
-# This is the new XWiki configuration file. In the future it'll replace the old
-# xwiki.cfg file. However right now it's only used by some XWiki components.
-# As time progresses more and more component will get their configurations from
-# this file.
-
-#-------------------------------------------------------------------------------------
-# Core
-#-------------------------------------------------------------------------------------
-
-#-# [Since 1.8RC2]
-#-# Specifies the default syntax to use when creating new documents.
-#-# Default value is xwiki/2.1.
-# core.defaultDocumentSyntax = xwiki/2.1
-
-#-# [Since 2.4M1]
-#-# Indicate if the rendering cache is enabled.
-#-# Default value is false.
-# core.renderingcache.enabled=true
-
-#-# [Since 2.4M1]
-#-# A list of Java regex patterns matching full documents reference.
-# core.renderingcache.documents=wiki:Space\.Page
-# core.renderingcache.documents=wiki:Space\..*
-# core.renderingcache.documents=Space\.PageOnWhateverWiki
-
-#-# [Since 2.4M1]
-#-# The time (in seconds) after which data should be removed from the cache when not used.
-#-# Default value is 300 (5 min).
-# core.renderingcache.duration=300
-
-#-# [Since 2.4M1]
-#-# The size of the rendering cache. Not that it's not the number of cached documents but the number of cached results.
-#-# (For a single document several cache entries are created, because each action, language and request query string
-#-# produces a unique rendering result)
-#-# Default value is 100.
-# core.renderingcache.size=100
-
-#-------------------------------------------------------------------------------------
-# Environment
-#-------------------------------------------------------------------------------------
-
-#-# [Since 3.5M1, replaces the container.persistentDirectory property]
-#-# The directory used to store persistent data (data that should persist across server restarts). This is an
-#-# important directory containing important data and thus it should never be deleted (it should be backed-up along
-#-# with the database).
-#-# For example this is where the Extension Manager stores downloaded extensions if the extension.localRepository
-#-# property isn't configured.
-#-#
-#-# You can set:
-#-# * an absolute path (recommended)
-#-# * a relative path (not recommended at all)but in this case the directory will be relative to where the XWiki server
-#-#   is started and thus the user under which XWiki is started will need write permissions for the current directory
-#-#
-#-# Note if the system property xwiki.data.dir is set then this property is not used.
-#-# If neither the system property nor this configuration value here are set then the Servlet container's temporary
-#-# directory is used; This is absolutely not recommended since that directory could be wiped out at any time and you
-#-# should specify a value.
-environment.permanentDirectory=/var/lib/xwiki
-
-#-------------------------------------------------------------------------------------
-# Rendering
-#-------------------------------------------------------------------------------------
-
-#-# [Since 1.8RC2]
-#-# Specifies how links labels are displayed when the user doesn't specify the label explicitly.
-#-# Valid values:
-#-#   %w: wiki name
-#-#   %s: space name
-#-#   %p: page name
-#-#   %P: page name with spaces between camel case words, i.e. "My Page" if the page name is "MyPage"
-#-#   %t: page title
-#-#
-#-# Note that if the page title is empty or not defined then it defaults to %p. This is also the case
-#-# if the title cannot be retrieved for the document.
-#-#
-#-# The default is "%p". Some examples: "%s.%p", "%w:%s.%p".
-# rendering.linkLabelFormat = %p
-
-#-# [Since 2.0M3]
-#-# Overrides default macro categories (Each macro has a default category already defined, for example
-#-# "presentation" for the Table of Contents Macro).
-#-#
-#-# Ex: To redefine the macro category for the TOC macro so that it'd be in the "My Category" category +
-#-# redefine the category for the Script Macro to be "My Other Category", you'd use:
-# rendering.macroCategories = toc:My Category
-# rendering.macroCategories = script:My Other Category
-
-#-# [Since 2.5M2]
-#-# Specify whether the image dimensions should be extracted from the image parameters and included in the image URL
-#-# or not. When image dimensions are included in the image URL the image can be resized on the server side before being
-#-# downloaded, improving thus the page loading speed.
-#-#
-#-# Default value is true.
-# rendering.imageDimensionsIncludedInImageURL = true
-
-#-# [Since 2.5M2]
-#-# One way to improve page load speed is to resize images on the server side just before rendering the page. The 
-#-# rendering module can use the image width provided by the user to scale the image (See
-#-# rendering.includeImageDimensionsInImageURL configuration parameter). When the user doesn't specify the image width
-#-# the rendering module can limit the width of the image based on this configuration parameter.
-#-#
-#-# The default value is -1 which means image width is not limited by default. Use a value greater than 0 to limit the
-#-# image width (pixels). Note that the aspect ratio is kept even when both the width and the height of the image are
-#-# limited.
-# rendering.imageWidthLimit = 1024
-# rendering.imageWidthLimit = -1
-
-#-# [Since 2.5M2]
-#-# See rendering.imageWidthLimit
-# rendering.imageHeightLimit = 768
-# rendering.imageHeightLimit = -1
-
-#-# [Since 2.5M2]
-#-# InterWiki definitions in the format alias=URL
-#-# See http://en.wikipedia.org/wiki/Interwiki_links for a definition of an InterWiki link
-# Some examples:
-# rendering.interWikiDefinitions = wikipedia = http://en.wikipedia.org/wiki/
-# rendering.interWikiDefinitions = definition = http://www.yourdictionary.com/
-
-#-------------------------------------------------------------------------------------
-# Rendering Transformations
-#-------------------------------------------------------------------------------------
-
-#-# [Since 2.6RC1]
-#-# Controls what transformations will be executed when rendering content.
-#-# A transformation modifies the parsed content. For example the Icon transformation replaces some characters with
-#-# icons, a WikiWord transformation will automatically create links when it finds wiki words, etc.
-#-# Note that the Macro transformation is a special transformation that replaces macro markers by the result of the
-#-# macro execution. If you don't list it, macros won't get executed.
-#-# The default value is: macro, icon
-# rendering.transformations = macro, icon
-
-#-# [Since 2.6RC1]
-#-# Icon Transformation Configuration
-#-# Defines mappings between suite of characters and the icon to display when those characters are found.
-#-# The format is: rendering.transformation.icon.mappings = <suite of characters> = <icon name>
-#-# The following mappings are already predefined and you don't need to redefine them unless you wish to override them
-#-# rendering.transformation.icon.mappings = :) = emoticon_smile
-#-# rendering.transformation.icon.mappings = :( = emoticon_unhappy
-#-# rendering.transformation.icon.mappings = :P = emoticon_tongue
-#-# rendering.transformation.icon.mappings = :D = emoticon_grin
-#-# rendering.transformation.icon.mappings = ;) = emoticon_wink
-#-# rendering.transformation.icon.mappings = (y) = thumb_up
-#-# rendering.transformation.icon.mappings = (n) = thumb_down
-#-# rendering.transformation.icon.mappings = (i) = information
-#-# rendering.transformation.icon.mappings = (/) = accept
-#-# rendering.transformation.icon.mappings = (x) = cancel
-#-# rendering.transformation.icon.mappings = (!) = error
-#-# rendering.transformation.icon.mappings = (+) = add
-#-# rendering.transformation.icon.mappings = (-) = delete
-#-# rendering.transformation.icon.mappings = (?) = help
-#-# rendering.transformation.icon.mappings = (on) = lightbulb
-#-# rendering.transformation.icon.mappings = (off) = lightbulb_off
-#-# rendering.transformation.icon.mappings = (*) = star
-
-#-------------------------------------------------------------------------------------
-# LinkChecker Transformation
-#-------------------------------------------------------------------------------------
-
-#-# [Since 3.3M2]
-#-# Defines the time (in ms) after which an external link should be checked again for validity.
-#-# the default configuration is:
-# rendering.transformation.linkchecker.timeout = 3600000
-
-#-# [Since 5.3RC1]
-#-# List of document references that are excluded from link checking, specified using regexes.
-#-# the default configuration is:
-# rendering.transformation.linkchecker.excludedReferencePatterns = .*:XWiki\.ExternalLinksJSON
-
-#-------------------------------------------------------------------------------------
-# Rendering Macros
-#-------------------------------------------------------------------------------------
-
-#-# Velocity Macro
-
-#-# [Since 2.0M1]
-#-# Defines which Velocity Filter to use by default. This offers the possibility to filter the Velocity macro content
-#-# before and after the Velocity Engine execution.
-#-# The following filters are available:
-#-# - indent (the default): Remove all first whites spaces of lines to support source code indentation without
-#-#          generating whitespaces in the resulting XDOM.
-#-# - none: Doesn't change the content
-#-# - html: Removes all leading and trailing white spaces and new lines. If you need a space you'll need to use
-#-#         \$sp and if you need a new line you'll need to use \$nl
-#-# rendering.macro.velocity.filter = indent
-
-#-------------------------------------------------------------------------------------
-# Cache
-#-------------------------------------------------------------------------------------
-
-#-# [Since 1.7M1]
-#-# The standard cache component implementation to use (can be local or distributed depending on the implementation).
-#-# The default standard cache implementation is Infinispan.
-# cache.defaultCache=infinispan
-
-#-# [Since 1.7M1]
-#-# The local cache implementation to use.
-#-# The default local cache implementation is Infinispan.
-# cache.defaultLocalCache=infinispan/local
-
-#-------------------------------------------------------------------------------------
-# Settings for the OpenOffice server instance consumed by the OfficeImporter component
-#-------------------------------------------------------------------------------------
- 
-#-# [Since 1.9M2]
-#-# Type of the openoffice server instance used by officeimporter component.
-#-# 0 - Internally managed server instance. (Default)
-#-# 1 - Externally managed (local) server instance.
-# openoffice.serverType=0
-
-#-# [Since 1.9M2]
-#-# Port number used for connecting to the openoffice server instance.
-#-# Default port is 8100 
-# openoffice.serverPort=8100
-
-#-# [Since 1.9M2]
-#-# If the openoffice server should be started / connected upon XE start.
-#-# Default value is false
-# openoffice.autoStart=false
-
-#-# [Since 1.8RC3]
-#-# Path to openoffice installation (serverType:0 only).
-#-# If no path is provided, a default value will be calculated based on the operating environment.
-# openoffice.homePath=/opt/openoffice.org3/
-
-#-# [Since 1.8RC3]
-#-# Path to openoffice execution profile (serverType:0 only).
-#-# If no path is provided, a default value will be calculated based on the operating environment.
-# openoffice.profilePath=/home/user/.openoffice.org/3
-
-#-# [Since 1.8RC3]
-#-# Maximum number of simultaneous conversion tasks to be handled by a single openoffice process (serverType:0 only).
-#-# Default value is 50
-# openoffice.maxTasksPerProcess=50
-
-#-# [Since 1.8RC3]
-#-# Timeout for conversion tasks (in milliseconds) (serverType:0 only).
-#-# Default value is 30 seconds
-# openoffice.taskExecutionTimeout=30000
-
-#-------------------------------------------------------------------------------------
-# Velocity
-#-------------------------------------------------------------------------------------
-
-#-# [Since 2.0M1]
-#-# Velocity Tools that will be available from your scripts. The format is
-#-# velocity.tools = <name under which it'll be available in the context> = <class name>
-#-# Default values (no need to add them)
-#-#   velocity.tools = listtool = org.apache.velocity.tools.generic.ListTool
-#-#   velocity.tools = numbertool = org.apache.velocity.tools.generic.NumberTool
-#-#   velocity.tools = datetool = org.apache.velocity.tools.generic.ComparisonDateTool
-#-#   velocity.tools = mathtool = org.apache.velocity.tools.generic.MathTool
-#-#   velocity.tools = sorttool = org.apache.velocity.tools.generic.SortTool     
-#-#   velocity.tools = escapetool = org.apache.velocity.tools.generic.EscapeTool
-#-#   velocity.tools = regextool = org.xwiki.velocity.tools.RegexTool
-#-#   velocity.tools = collectionstool = org.xwiki.velocity.tools.CollectionsTool
-#-#   velocity.tools = stringtool = org.apache.commons.lang3.StringUtils
-#-#   velocity.tools = jsontool = org.xwiki.velocity.tools.JSONTool
-#-#   velocity.tools = urltool = org.xwiki.velocity.tools.URLTool
-#-#   velocity.tools = cookietool = org.apache.velocity.tools.view.CookieTool
-#-#   velocity.tools = exceptiontool = org.apache.commons.lang3.exception.ExceptionUtils
-
-#-# [Since 2.0M1]
-#-# Velocity configuration properties. The format is
-#-# velocity.properties = <Velocity property name> = <value>
-#-# Default values (no need to add them)
-#-#   velocity.properties = resource.loader = webapp
-#-#   velocity.properties = directive.set.null.allowed = true
-#-#   velocity.properties = webapp.resource.loader.class = org.apache.velocity.tools.view.servlet.WebappLoader
-#-#   velocity.properties = velocimacro.messages.on = false
-#-#   velocity.properties = resource.manager.logwhenfound = false
-#-#   velocity.properties = velocimacro.permissions.allow.inline.local.scope = true
-#-#   velocity.properties = runtime.introspector.uberspect = org.xwiki.velocity.introspection.ChainingUberspector
-#-#   velocity.properties = runtime.introspector.uberspect.chainClasses = org.xwiki.velocity.introspection.SecureUberspector\,org.xwiki.velocity.introspection.DeprecatedCheckUberspector\,org.xwiki.velocity.introspection.MethodArgumentsUberspector
-
-#-------------------------------------------------------------------------------------
-# Groovy
-#-------------------------------------------------------------------------------------
-
-#-# [Since 4.1M1]
-#-# Allows to specify Compiler customization for the Groovy execution engine.
-#-# There's no customizers defined by default. Available customizer ids:
-#-# - timedinterrupt: interrupt script execution if it takes longer than a given time (default to 1 minute)
-#-# - secure: runs Groovy in a security sandbox
-#-# groovy.compilationCustomizers=<list of customizer ids here>
-
-#-# Timed Interrupt Customizer
-
-#-# [Since 4.1M1]
-#-# Default execution time for a script before a timeout occurs, in seconds.
-#-# groovy.customizer.timedInterrupt.timeout=60
-
-#-------------------------------------------------------------------------------------
-# Events distribution
-#-------------------------------------------------------------------------------------
-
-#-# [Since 2.0M3]
-#-# Indicate if the network distribution module is enabled or not.
-#-# By default remote events are disabled.
-# observation.remote.enabled = false
-
-#-# [Since 2.0M3]
-#-# The list of events communication channels to start when the application starts.
-#-# By default no channel is configured.
-#-#
-#-# The default remote event distribution implementation is using JGroups and you'll need to either use embedded JGroups configuration
-#-# files or drop your custom configuration in the WEB-INF/observation/remote/jgroups/ directory.
-#-# There's a README file in that directory with more information.
-#-# Example: observation.remote.channels = public, cluster
-
-#-# [Since 2.0M4]
-#-# The implementation of network adapter to use.
-#-# The default is jgroups.
-#-#
-#-# By default only jgroups is provided. To add one implements NetworkAdaptor component interface. The identifier provided in the configuration is matched with the component role hint.
-#-# Example: observation.remote.networkadapter = jgroups
-
-#-------------------------------------------------------------------------------------
-# Cryptographic services
-#-------------------------------------------------------------------------------------
-
-#-# [Since 2.5M1]
-#-# Which cipher should be used for encrypting text with a password.
-#-#
-#-# Options are:
-#-# CAST5PasswordCiphertext (Uses CAST-5 cipher engine with a 128 bit key)
-#-# AESPasswordCiphertext (Uses AES cipher engine with a 128 bit key)
-#-#
-#-# NOTE: Encrypted text can still be decrypted even if the cipher or key function has changed.
-#-#
-#crypto.passwd.passwordCiphertext = CAST5PasswordCiphertext
-
-#-# [Since 2.5M1]
-#-# Which key derivation function to use.
-#-# Since the easiest attack on password encrypted text is to guess passwords, this function ensures that verification
-#-# of a password takes a long time for the computer and is inherently difficult to parallelize.
-#-#
-#-# Options are:
-#-# ScryptMemoryHardKeyDerivationFunction (Uses the scrypt key function which forces password guessers to expend a
-#-#                                        a configurable amount of processor time and memory to validate guesses
-#-#                                        Scrypt is conjectured to be 260 times the strength of PBKDF2
-#-#                                        Function definition available here: http://www.tarsnap.com/scrypt.html)
-#-# PBKDF2KeyDerivationFunction (Uses password based key derivation function 2 (PBKDF2) developed by RSA labs as part
-#-#                              of the PKCS#5 standard. This function uses a configurable amount of processor time
-#-#                              but an insignificant amount of memory.
-#-#                              Function definition available here: http://www.apps.ietf.org/rfc/rfc2898.html#sec-5.2)
-#-#
-#crypto.passwd.keyDerivationFunctionClassForEncryption = ScryptMemoryHardKeyDerivationFunction
-
-#-# [Since 2.5M1]
-#-# Define the properties for initializing the dey derivation functions for encryption.
-#-#
-#-# millisecondsOfProcessorTimeToSpend is used to test run the key function and decide how many iterations it should
-#-#                                    use. Remember this amount of time will be required to convert the password to
-#-#                                    the decryption key every time the text needs to be decrypted.
-#-# numberOfKilobytesOfMemoryToUse will be ignored unless a memory hard function such as scrypt is chosen in which
-#-#                                case it will be used to define how much memory should be required to derive the
-#-#                                decryption key from the password.
-#-#
-#-# CAUTION: If numberOfKilobytesOfMemoryToUse is set too large, the computer may be able to encrypt a piece of text
-#-#          when it has lots of free memory available, then be unable to decrypt that text when less memory is
-#-#          available. Unless you are very paranoid, 1 megabyte (1024) is plenty of strength.
-#-#
-#crypto.passwd.keyDerivationFunctionPropertiesForEncryption = millisecondsOfProcessorTimeToSpend = 200
-#crypto.passwd.keyDerivationFunctionPropertiesForEncryption = numberOfKilobytesOfMemoryToUse = 1024
-
-#-# [Since 2.5M1]
-#-# Which key derivation function to use for protecting (hashing) passwords.
-#-# Options include:
-#-# ScryptMemoryHardKeyDerivationFunction (See above for more information)
-#-# PBKDF2KeyDerivationFunction (See above for more information)
-#-#
-#crypto.passwd.keyDerivationFunctionClassForPasswordVerification = ScryptMemoryHardKeyDerivationFunction
-
-#-# [Since 2.5M1]
-#-# Properties to use when initializing key derivation functions for password protection.
-#-#
-#-# millisecondsOfProcessorTimeToSpend (See above for description.)
-#-# numberOfKilobytesOfMemoryToUse (See above for description.)
-#-# derivedKeyLength is the number of bytes of length which the output key should be. In a password verification
-#-#                  context, this is only valid for decreasing the chance of a collision.
-#-#
-#-# CAUTION: If numberOfKilobytesOfMemoryToUse is set too large, the computer may be able to protect a password
-#-#          when it has lots of free memory available, then be unable to validate that password when less memory is
-#-#          available. Unless you are very paranoid, 1 megabyte (1024) is plenty of strength.
-#-#
-#crypto.passwd.keyDerivationFunctionPropertiesForPasswordVerification = millisecondsOfProcessorTimeToSpend = 200
-#crypto.passwd.keyDerivationFunctionPropertiesForPasswordVerification = numberOfKilobytesOfMemoryToUse = 1024
-#crypto.passwd.keyDerivationFunctionPropertiesForPasswordVerification = derivedKeyLength = 32
-
-#-------------------------------------------------------------------------------------
-# CSRF token component
-#-------------------------------------------------------------------------------------
-
-#-# [Since 2.5M2]
-#-# Controls whether secret token validation mechanism should be used (to prevent CSRF attacks).
-#-#
-#-# If enabled, all actions requiring "comment", "edit", "delete", "admin" or "programming" rights
-#-# will check that the parameter "form_token" with the value of a random secret token is present
-#-# in the request.
-#-# 
-#-# Valid values:
-#-#   true : Enabled
-#-#   false: Disabled
-#-#
-#-# Default value is true
-# csrf.enabled = true
-
-#-------------------------------------------------------------------------------------
-# Extension Manager
-#-------------------------------------------------------------------------------------
-
-#-# [Since 2.5]
-#-# Repositories to use when searching and downloading extensions.
-#-# 
-#-# The format is <id>:<type>:<url> where
-#-# * id can be anything as long as there is only one
-#-# * type is the type of the repository (maven, xwiki, etc.)
-#-# * url is the URL or the root of the repository
-#-# 
-#-# [Since 4.3] It's also possible to associate various properties to each repository.
-#-# Here are the standard properties:
-#-# * user: the user to use to authenticate to the repository
-#-# * password: the password to use to authenticate to the repository
-#-# 
-#-# Here is an example:
-# extension.repositories=privatemavenid:maven:http://host.com/private/maven/
-# extension.repositories.privatemavenid.auth.user=someuser
-# extension.repositories.privatemavenid.auth.password=thepassword
-#-# 
-#-# Here's an example to add your local Maven Repository
-# extension.repositories=local:maven:file://${sys:user.home}/.m2/repository
-#-#
-#-# And an example to add the XWiki Maven Snapshot Repository
-# extension.repositories=maven-xwiki-snapshot:maven:http://nexus.xwiki.org/nexus/content/groups/public-snapshots
-#-#
-#-# When not set the following is taken:
-# extension.repositories=maven-xwiki:maven:http://nexus.xwiki.org/nexus/content/groups/public
-# extension.repositories=extensions.xwiki.org:xwiki:http://extensions.xwiki.org/xwiki/rest/
-#-# 
-#-# To not have any repository enabled (including disabling default repositories) you can explicitly make this list empty:
-# extension.repositories=
-
-#-# [Since 2.5]
-#-# The directory where extensions are stored after being downloaded.
-#-# 
-#-# The default is extension/repository in whatever is the general persistent directory.
-#-# See container.persistentDirectory.
-# extension.localRepository=extension/repository
-
-#-# [Since 3.4]
-#-# The user agent to use when communication with external services (generally repositories).
-#-# 
-#-# The default is:
-# extension.userAgent=XWikiExtensionManager
-
-#-------------------------------------------------------------------------------------
-# Solr Search
-#-------------------------------------------------------------------------------------
-
-#-# [Since 4.5M1]
-#-# The Solr server type. Currently accepted values are "embedded" (default) and "remote".
-# solr.type=embedded
-
-#-# [Since 4.5M1]
-#-# The location where the embedded Solr instance stores its configuration and the indexed data.
-#-# The default is the subfolder "solr" inside the folder defined by the property "environment.permanentDirectory".
-# solr.embedded.home=/var/local/xwiki/solr
-
-#-# [Since 4.5M1]
-#-# The URL to use to connect to the remote solr server.
-#-# The default value assumes that the remote Solr server is started in a different process on the same machine, using the default port.
-# solr.remote.url=http://localhost:8983/solr
-
-#-# [Since 5.1M1]
-#-# Elements to index are not sent to the Solr server one by one but in batch to improve performances.
-#-# It's possible to configure this behavior with the following properties:
-#-# 
-#-# The maximum number of elements sent at the same time to the Solr server
-#-# The default is 50.
-# solr.indexer.batch.size=50
-#-# The maximum number of characters in the batch of elements to send to the Solr server.
-#-# The default is 10000.
-# solr.indexer.batch.maxLength=10000
-
-#-# [Since 5.1M1]
-#-# The maximum number of elements in the background queue of elements to index/delete
-#-# The default is 10000.
-# solr.indexer.queue.capacity=100000
-
-#-# [Since 6.1M2]
-#-# Indicating if a synchronization between SOLR index and XWiki database should be run at startup.
-#-# Synchronization can be started from search administration.
-#-# The default is true.
-# solr.synchronizeAtStartup=false
-
-#-------------------------------------------------------------------------------------
-# Security
-#-------------------------------------------------------------------------------------
-
-#-# [Since 5.0M2]
-#-# Define the authorization policies by choosing another implementation of the AuthorizationSettler. This component
-#-# is solely responsible for settling access decisions based on user, target entity and available security rules.
-#-# The identifier provided here is matched with the component role hint.
-#-#
-#-# The default is:
-# security.authorization.settler=default
-
-#-------------------------------------------------------------------------------------
-# URL
-#-------------------------------------------------------------------------------------
-
-#-# IMPORTANT: The URL module is a feature still in development and as such should be considered experimental at the
-#-# moment. The configuration parameters below are used only in some part of the code at the moment. The idea is to
-#-# progressively refactor more and more till only the new properties are used. For the moment you should continue to
-#-# use the following old properties located in xwiki.cfg:
-#-#  xwiki.virtual.usepath
-#-#  xwiki.virtual.usepath.servletpath
-
-#-# [Since 5.1M1]
-#-# The id of the URL format to use. This allows to plug in different implementations and thus allows to completely
-#-# control the format of XWiki URLs.
-#-#
-#-# The default is:
-# url.format=standard
-
-#-# [Since 5.1M1]
-#-# Defines where the wiki part is defined in a URL pointing to a subwiki
-#-# If true then the wiki part is located in the URL path (a.k.a path-based), for example:
-#-#   http://server/xwiki/wiki/mywiki/view/Space/Page
-#-# If false then the wiki part is located in the URL host domain (a.k.a domain-based), for example:
-#-#   http://mywiki.domain/xwiki/bin/view/Space/Page
-#-#
-#-# The default is:
-# url.standard.multiwiki.isPathBased=true
-
-#-# [Since 5.1M1]
-#-# For path-based setups, this property defines the path segment before the one identifying the subwiki in the URL.
-#-# For example if set to "thewiki", then the following URL will point to a subwiki named "mywiki":
-#-#   http://server/xwiki/thewiki/mywiki/view/Space/Page
-#-# Note that the mapping in web.xml has to be modified accordingly if you don't use the default value:
-#-#   <servlet-mapping>
-#-#     <servlet-name>action</servlet-name>
-#-#     <url-pattern>/wiki/*</url-pattern>
-#-#   </servlet-mapping>
-#-#
-#-# The default is:
-# url.standard.multiwiki.wikiPathPrefix=wiki
-
-#-# [Since 5.2M1]
-#-# Defines the URL path prefix used for Entity URLs, i.e. URLs pointing to a Document, Space, Object, etc.
-#-# For example this is the "bin" part in the following URL:
-#-#   http://server/xwiki/bin/view/space/page
-#-# Note that this replaces the old xwiki.defaultservletpath property in the old xwiki.cfg file.
-#-#
-#-# The default is:
-# url.standard.getEntityPathPrefix=bin
-
-#-# [Since 5.3M1]
-#-# The action to take when a subwiki is not found (ie there's no wiki descriptor for it). Valid values are:
-#-# - redirect_to_main_wiki: default to displaying the main wiki
-#-# - display_error: redirect to a vm to display an error
-#-#
-#-# The default is:
-# url.standard.multiwiki.notFoundBehavior=redirect_to_main_wiki
-
-#-------------------------------------------------------------------------------------
-# Attachment
-#-------------------------------------------------------------------------------------
-
-#-# [Since 5.2M2]
-#-# Define the kind of attachment that can be displayed inline. You can either choose to do it through a whitelist (only
-#-# the mimetypes defined in this list would be displayed inline) or a blacklist (every mimetype that is not in this list
-#-# would be displayed inline if possible)
-#-#
-#-# By default we use the following whitelist (coma separated list of values).
-# attachment.download.whitelist=audio/basic,audio/L24,audio/mp4,audio/mpeg,audio/ogg,audio/vorbis,audio/vnd.rn-realaudio,audio/vnd.wave,audio/webm,image/gif,image/jpeg,image/pjpeg,image/png,image/svg+xml,image/tiff,text/csv,text/plain,text/xml,text/rtf,video/mpeg,video/ogg,video/quicktime,video/webm,video/x-matroska,video/x-ms-wmv,video/x-flv 
-#-#
-#-# If you prefer to use a blacklist instead, you can define the forbidden types here, as a coma separated list of values.
-#-# We advise you to forbid at least the following mimetypes : text/html, text/javascript
-# attachment.download.blacklist=text/html,text/javascript 
-
-#-------------------------------------------------------------------------------------
-# Active Installs
-#-------------------------------------------------------------------------------------
-
-#-# [Since 5.2M2]
-#-# The URL of where the Active Installs module should connect to in order to send a ping of activity. This feature
-#-# regularly sends the following information to xwiki.org about the current instance:
-#-# - its unique id
-#-# - the id and versions of all installed extensions)
-#-# The goal is to count the number of active installs of XWiki out there and provide statistics on xwiki.org
-#-#
-#-# The default is:
-# activeinstalls.pingURL=http://extensions.xwiki.org/activeinstalls
-
-#-------------------------------------------------------------------------------------
-# Wikis
-#-------------------------------------------------------------------------------------
-
-#-# [Since 5.4.4]
-#-# Add a default suffix to the alias of a new wiki in the wiki creation wizard, only when the path mode is used
-#-# (see url.standard.multiwiki.isPathBased). If this value is empty, XWiki will try to compute it automatically from
-#-# request URL.
-#-#
-#-# eg: if wiki.alias.suffix is "xwiki.org" and the wiki name is "playground"
-#-#     then the computed alias will be: "playground.xwiki.org".
-#-#
-#-# The default is:
-# wiki.alias.suffix=
-
-#-------------------------------------------------------------------------------------
-# Store
-#-------------------------------------------------------------------------------------
-
-#-# [Since 6.1M2]
-#-# If active, the Filesystem Attachment Store will automatically clear empty directories on startup,
-#-# in some cases this may create undue load on the server and may need to be disabled. To do that,
-#-# set the following to false.
-#-# Note that if you disable this feature, empty directories will accumulate and you are responsible
-#-# for cleaning them up.
-# store.fsattach.cleanOnStartup=true
-
-#-------------------------------------------------------------------------------------
-# Mail
-#-------------------------------------------------------------------------------------
-
-#-# [Since 6.1M2]
-#-# SMTP host when sending emails, defaults to "localhost".
-#-# This configuration property can be overridden in XWikiPreferences objects, by using the "smtp_server" property name.
-# mail.sender.host = localhost
-
-#-# [Since 6.1M2]
-#-# SMTP port when sending emails, defaults to 25.
-#-# This configuration property can be overridden in XWikiPreferences objects, by using the "smtp_port" property name.
-# mail.sender.port = 25
-
-#-# [Since 6.1M2]
-#-# From email address to use. Not defined by default and needs to be set up when calling the mail API.
-#-# This configuration property can be overridden in XWikiPreferences objects, by using the "admin_email" property name.
-# mail.sender.from = john@doe.com
-
-#-# [Since 6.1M2]
-#-# Username to authenticate on the SMTP server, if needed. By default no authentication is performed.
-#-# This configuration property can be overridden in XWikiPreferences objects, by using the "smtp_server_username"
-#-# property name.
-# mail.sender.username = someuser
-
-#-# [Since 6.1M2]
-#-# Password to authenticate on the SMTP server, if needed. By default no authentication is performed.
-#-# This configuration property can be overridden in XWikiPreferences objects, by using the "smtp_server_password"
-#-# property name.
-# mail.sender.password = somepassword
-
-#-# [Since 6.1M2]
-#-# Extra Java Mail options (see https://javamail.java.net/nonav/docs/api/).
-#-# This configuration property can be overridden in XWikiPreferences objects, by using the "javamail_extra_props"
-#-# property name.
-#-# By default the following properties are set automatically:
-#-#   mail.transport.protocol = smtp
-#-#   mail.smtp.host = <value of the mail.sender.host property>
-#-#   mail.smtp.port = <value of the mail.sender.port property>
-#-#   mail.smtp.user = <value of the mail.sender.username property>
-#-#   mail.smtp.from = <value of the mail.sender.from property>
-#-# Example:
-# mail.sender.properties = mail.smtp.starttls.enable = true
-# mail.sender.properties = mail.smtp.socks.host = someserver
-
-#-# [Since 6.4M2]
-#-# Defines which authorization checks are done when sending mails using the Mail Sender Script Service.
-#-# Example of valid values:
-#-# - "programmingrights": the current document must have Programming Rights
-#-# - "alwaysallow": no check is performed. This is useful when running XWiki in a secure environment where we
-#-#   want to allow all users to be able to send emails through the Script Service.
-#-# The default is:
-# mail.sender.scriptServiceCheckerHint = programmingrights
-
-#-# [Since 6.4M2]
-#-# optional default email addresses to add to the BCC mail header when sending email.
-# mail.sender.bcc = john@doe.com,mary@doe.com
-
-#-# [Since 6.4RC1]
-#-# The delay to wait between each mail being sent, in milliseconds. This is done to support mail throttling and not
-#-# be considered a spammer by mail servers.
-#-# The default is 8 seconds:
-# mail.sender.sendWaitTime = 8000
-
-#-# [Since 6.4.1, 7.0M1]
-#-# When using the Database Mail Listener, whether mail statuses for mails that have been sent successfully must be
-#-# discarded or not. They could be kept for tracability purpose for example.
-#-# The default is:
-# mail.sender.database.discardSuccessStatuses = true
-
-#-------------------------------------------------------------------------------------
-# WatchList
-#-------------------------------------------------------------------------------------
-
-#-# [Since 7.0RC1]
-#-# Controls if the realtime notifications feature is enabled. Default value is false.
-#-# This is currently an experimental feature which is not yet ready for producton. Enabling it right now will cause performance issues.
-#-# Once the feature stabilizes, it will be enabled by default and the option to disabled it will be removed.
-# watchlist.realtime.enabled = false
-
-
diff --git a/xwiki/hibernate.cfg.xml b/xwiki/hibernate.cfg.xml
index 6571f90f74973c2d5daaa3ffd26e1d736bfdfbae..6411837fba6e78a9d3cde458c2df200ba51b193c 100644
--- a/xwiki/hibernate.cfg.xml
+++ b/xwiki/hibernate.cfg.xml
@@ -85,8 +85,8 @@
              you will also have to set the property xwiki.db in xwiki.cfg file
     -->
     <property name="connection.url">jdbc:mysql://db/${MYSQL_DATABASE:-xwiki}?useSSL=false</property>
-    <property name="connection.username">${MYSQL_USER:-xwiki}</property>
-    <property name="connection.password">${MYSQL_PASSWORD:-xwiki}</property>
+    <property name="connection.username">replacemysqluser</property>
+    <property name="connection.password">replacemysqlpassword</property>
     <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
     <property name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
     <property name="dbcp.poolPreparedStatements">true</property>
diff --git a/xwiki/start_xwiki.sh b/xwiki/start_xwiki.sh
new file mode 100755
index 0000000000000000000000000000000000000000..38dc633edd3f1a9f5cadb1b4b08d7b51e61f05a3
--- /dev/null
+++ b/xwiki/start_xwiki.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+function first_start() {
+  configure
+  sudo -u tomcat8 touch /var/lib/tomcat8/.first_start_completed
+}
+
+function configure() {
+  echo 'Configuring XWiki...'
+  sudo -u tomcat8 sed -i "s/replacemysqluser/${MYSQL_USERNAME:-xwiki}/g" /var/lib/tomcat8/webapps/ROOT/WEB-INF/hibernate.cfg.xml
+  sudo -u tomcat8 sed -i "s/replacemysqlpassword/${MYSQL_PASSWORD:-xwiki}/g" /var/lib/tomcat8/webapps/ROOT/WEB-INF/hibernate.cfg.xml
+
+  echo '  Using filesystem-based attachments...'
+  xwiki-set-cfg 'xwiki.store.attachment.hint' 'file'
+  xwiki-set-cfg 'xwiki.store.attachment.versioning.hint' 'file'
+  xwiki-set-cfg 'xwiki.store.attachment.recyclebin.hint' 'file'
+  echo '  Generating authentication validation and encryption keys...'
+  xwiki-set-cfg 'xwiki.authentication.validationKey' "$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
+  xwiki-set-cfg 'xwiki.authentication.encryptionKey' "$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
+
+  echo '  Setting permanent directory...'
+  xwiki-set-properties 'environment.permanentDirectory' '/var/lib/xwiki'
+}
+
+if [[ ! -f /var/lib/tomcat/.first_start_completed ]]; then
+  first_start
+fi
+
+sudo -u tomcat8 /usr/share/tomcat8/bin/catalina.sh run
\ No newline at end of file
diff --git a/xwiki/xwiki-config-replace.sh b/xwiki/xwiki-config-replace.sh
new file mode 100755
index 0000000000000000000000000000000000000000..963af5df6c5fd9bc6e27ddfe65ed599b0d610332
--- /dev/null
+++ b/xwiki/xwiki-config-replace.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+# $1 - the path to xwiki.[cfg|properties]
+# $2 - the setting/property to set
+# $3 - the new value
+
+sed -i s~"\#\? \?$2 \?=.*"~"$2=$3"~g "$1"
\ No newline at end of file
diff --git a/xwiki/xwiki-set-cfg b/xwiki/xwiki-set-cfg
new file mode 100755
index 0000000000000000000000000000000000000000..fb816bc4c5c3e1c045610cec2ccffb8bbba78cd5
--- /dev/null
+++ b/xwiki/xwiki-set-cfg
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+# $1 - the setting/property to set
+# $2 - the new value
+
+sudo -u tomcat8 xwiki-config-replace.sh /var/lib/tomcat8/webapps/ROOT/WEB-INF/xwiki.cfg "$1" "$2"
\ No newline at end of file
diff --git a/xwiki/xwiki-set-properties b/xwiki/xwiki-set-properties
new file mode 100755
index 0000000000000000000000000000000000000000..9ed9b49ff418d99743f1cfa1ca61513fbb7051df
--- /dev/null
+++ b/xwiki/xwiki-set-properties
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+# $1 - the setting/property to set
+# $2 - the new value
+
+sudo -u tomcat8 xwiki-config-replace.sh /var/lib/tomcat8/webapps/ROOT/WEB-INF/xwiki.properties "$1" "$2"
\ No newline at end of file