From 9622add90946200e89c993afd2fe1540de1ca4db Mon Sep 17 00:00:00 2001
From: Timm Fitschen <timm.fitschen@ds.mpg.de>
Date: Thu, 21 Mar 2019 13:03:48 +0100
Subject: [PATCH] MAINT: new structure in conf with core/ext

---
 .gitignore                                                | 4 ++--
 .gitlab-ci.yml                                            | 2 +-
 README_SETUP.md                                           | 4 ++--
 caosdb-webui                                              | 2 +-
 conf/{ => core}/cache.ccf                                 | 0
 conf/{ => core}/logging.conf                              | 0
 conf/{ => core}/server.conf.template                      | 0
 conf/{ => core}/usersources.ini.template                  | 0
 makefile                                                  | 8 ++++----
 misc/chown_script/chown_script_template                   | 2 +-
 pom.xml                                                   | 2 +-
 src/main/java/caosdb/server/ServerProperties.java         | 6 +++---
 .../caosdb/server/resource/FileSystemResourceTest.java    | 2 +-
 13 files changed, 16 insertions(+), 16 deletions(-)
 rename conf/{ => core}/cache.ccf (100%)
 rename conf/{ => core}/logging.conf (100%)
 rename conf/{ => core}/server.conf.template (100%)
 rename conf/{ => core}/usersources.ini.template (100%)

diff --git a/.gitignore b/.gitignore
index af5f5653..72f026c0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,6 @@
 # configuration files
-/conf/*
-!/conf/*.template
+/conf/ext/*
+!/conf/core/*.template
 
 # dot files but not .gitignore
 .*
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index fa6f59e5..e078dfd4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -81,7 +81,7 @@ test:server:
     dependencies:
         - build:server
     script:
-        - echo "defaultRealm = CaosDB" > conf/usersources.ini
+        - echo "defaultRealm = CaosDB" > conf/ext/usersources.ini
         - mvn test
 
 ###########
diff --git a/README_SETUP.md b/README_SETUP.md
index 426867f6..8f8329cc 100644
--- a/README_SETUP.md
+++ b/README_SETUP.md
@@ -27,7 +27,7 @@ On Debian, the required packages can be installed with:
 After a fresh clone of the repository, this is what you need to setup the server:
 
 1. It is recommended to run the unit tests with `make test`
-2. Copy `conf/server.conf.template` to `conf/server.conf` and change it
+2. Copy `conf/core/server.conf.template` to `conf/ext/server.conf` and change it
    appropriately:
     * Setup for MySQL back-end: Assuming that the mysql back-end is installed,
       specify the fields `MYSQL_USER_NAME`, `MYSQL_USER_PASSWORD`,
@@ -38,7 +38,7 @@ After a fresh clone of the repository, this is what you need to setup the server
     * Select a path for the file system and set the fields `FILE_SYSTEM_ROOT`,
       `DROP_OFF_BOX`, and `TMP_FILES`.
     * Maybe set another `SESSION_TIMEOUT_MS`.
-3. Copy `conf/usersources.ini.template` to `conf/usersources.ini`.
+3. Copy `conf/core/usersources.ini.template` to `conf/ext/usersources.ini`.
     * Define the users/groups who you want to include/exclude.
     * Assign at least one user the `administration` role.
     * It is important, that the file complies with the ini file specification.
diff --git a/caosdb-webui b/caosdb-webui
index 7a0afa2e..4952d4b1 160000
--- a/caosdb-webui
+++ b/caosdb-webui
@@ -1 +1 @@
-Subproject commit 7a0afa2ed82197d11c0787e749371381ff119df8
+Subproject commit 4952d4b1b2645341d5e225857484a260304e0ee5
diff --git a/conf/cache.ccf b/conf/core/cache.ccf
similarity index 100%
rename from conf/cache.ccf
rename to conf/core/cache.ccf
diff --git a/conf/logging.conf b/conf/core/logging.conf
similarity index 100%
rename from conf/logging.conf
rename to conf/core/logging.conf
diff --git a/conf/server.conf.template b/conf/core/server.conf.template
similarity index 100%
rename from conf/server.conf.template
rename to conf/core/server.conf.template
diff --git a/conf/usersources.ini.template b/conf/core/usersources.ini.template
similarity index 100%
rename from conf/usersources.ini.template
rename to conf/core/usersources.ini.template
diff --git a/makefile b/makefile
index 5bd27064..c3382cff 100644
--- a/makefile
+++ b/makefile
@@ -30,20 +30,20 @@ run: compile
 	mvn exec:exec
 
 run-debug: compile
-	mvn exec:exec -Dexec.args="-classpath %classpath -Djava.util.logging.config.file=./conf/logging.conf caosdb.server.CaosDBServer silent debug"
+	mvn exec:exec -Dexec.args="-classpath %classpath -Djava.util.logging.config.file=./conf/core/logging.conf caosdb.server.CaosDBServer silent debug"
 
 compile: easy-units
 	mvn compile
 
 run-nobackend:
-	mvn exec:exec -Dexec.args="-classpath %classpath -Djava.util.logging.config.file=./conf/logging.conf caosdb.server.CaosDBServer silent debug nobackend insecure"
+	mvn exec:exec -Dexec.args="-classpath %classpath -Djava.util.logging.config.file=./conf/core/logging.conf caosdb.server.CaosDBServer silent debug nobackend insecure"
 
 start-portforwarding:
 	sudo iptables -t nat -N CAOSDB
 	sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -g CAOSDB
 	sudo iptables -t nat -A PREROUTING -p tcp --dport 443 -g CAOSDB
-	sudo iptables -t nat -A CAOSDB -p tcp --dport 80 -j REDIRECT --to-port $$(grep "SERVER_PORT_HTTP[^S]" conf/server.conf | grep -o -e "[0-9]*")
-	sudo iptables -t nat -A CAOSDB -p tcp --dport 443 -j REDIRECT --to-port $$(grep "SERVER_PORT_HTTPS" conf/server.conf | grep -o -e "[0-9]*")
+	sudo iptables -t nat -A CAOSDB -p tcp --dport 80 -j REDIRECT --to-port $$(grep "SERVER_PORT_HTTP[^S]" conf/ext/server.conf | grep -o -e "[0-9]*")
+	sudo iptables -t nat -A CAOSDB -p tcp --dport 443 -j REDIRECT --to-port $$(grep "SERVER_PORT_HTTPS" conf/ext/server.conf | grep -o -e "[0-9]*")
 
 stop-portforwarding:
 	sudo iptables -t nat -D PREROUTING -p tcp --dport 80 -g CAOSDB
diff --git a/misc/chown_script/chown_script_template b/misc/chown_script/chown_script_template
index 78714af5..bd006f7e 100755
--- a/misc/chown_script/chown_script_template
+++ b/misc/chown_script/chown_script_template
@@ -22,7 +22,7 @@
 # ** end header
 #
 
-LOC_DROPOFFBOX=$(awk < ./conf/server.conf '{ if ($1 == "DROP_OFF_BOX") print $3 }')
+LOC_DROPOFFBOX=$(awk < ./conf/ext/server.conf '{ if ($1 == "DROP_OFF_BOX") print $3 }')
 DB_USER=__DB_USER__
 DB_GROUP=__DB_GROUP__
 CMD_CHOWN=__CMD_CHOWN__
diff --git a/pom.xml b/pom.xml
index fc3b25d2..e78e1b0d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -224,7 +224,7 @@
             <arguments>
               <argument>-classpath</argument>
               <classpath/>
-              <argument>-Djava.util.logging.config.file=./conf/logging.conf</argument>
+              <argument>-Djava.util.logging.config.file=./conf/core/logging.conf</argument>
               <argument>caosdb.server.CaosDBServer</argument>
               <argument>silent</argument>
             </arguments>
diff --git a/src/main/java/caosdb/server/ServerProperties.java b/src/main/java/caosdb/server/ServerProperties.java
index 761dc4a3..32d7fa32 100644
--- a/src/main/java/caosdb/server/ServerProperties.java
+++ b/src/main/java/caosdb/server/ServerProperties.java
@@ -138,7 +138,7 @@ public class ServerProperties extends Properties {
     serverProperties.setProperty(KEY_DROP_OFF_BOX, "CaosDBFileSystem/DropOffBox/");
     serverProperties.setProperty(KEY_TMP_FILES, "CaosDBFileSystem/TMP/");
     serverProperties.setProperty(KEY_CHOWN_SCRIPT, "misc/chown_script/caosdb_chown_dropoffbox");
-    serverProperties.setProperty(KEY_USER_SOURCES_INI_FILE, basepath + "/conf/usersources.ini");
+    serverProperties.setProperty(KEY_USER_SOURCES_INI_FILE, basepath + "/conf/ext/usersources.ini");
     serverProperties.setProperty(KEY_USER_FOLDERS, "FALSE");
     serverProperties.setProperty(KEY_NEW_USER_DEFAULT_ACTIVITY, "INACTIVE");
     serverProperties.setProperty(KEY_AUTH_OPTIONAL, "FALSE");
@@ -186,7 +186,7 @@ public class ServerProperties extends Properties {
     serverProperties.setProperty(KEY_UNITS_FILE, basepath + "/src/main/java/caosdb/unit/si.units");
 
     serverProperties.setProperty(KEY_TRANSACTION_BENCHMARK_ENABLED, "true");
-    serverProperties.setProperty(KEY_CACHE_CONF_LOC, "conf/cache.ccf");
+    serverProperties.setProperty(KEY_CACHE_CONF_LOC, "conf/core/cache.ccf");
 
     serverProperties.setProperty(KEY_RULES_CACHE_CAPACITY, "100");
     serverProperties.setProperty(KEY_SPARSE_ENTITY_CACHE_CAPACITY, "1000");
@@ -201,7 +201,7 @@ public class ServerProperties extends Properties {
     serverProperties.setProperty(KEY_QUERY_FILTER_ENTITIES_WITHOUT_RETRIEVE_PERMISSIONS, "TRUE");
 
     try {
-      final File confFile = new File(basepath + "/conf/server.conf");
+      final File confFile = new File(basepath + "/conf/ext/server.conf");
       if (confFile.exists()) {
         final BufferedInputStream sp_in = new BufferedInputStream(new FileInputStream(confFile));
         serverProperties.load(sp_in);
diff --git a/src/test/java/caosdb/server/resource/FileSystemResourceTest.java b/src/test/java/caosdb/server/resource/FileSystemResourceTest.java
index 189e7802..31d6c6a6 100644
--- a/src/test/java/caosdb/server/resource/FileSystemResourceTest.java
+++ b/src/test/java/caosdb/server/resource/FileSystemResourceTest.java
@@ -29,7 +29,7 @@ public class FileSystemResourceTest {
 
   @Test(expected = NullPointerException.class)
   public void testGetFileElementNullDir() throws Exception {
-    new FileSystemResource().getFileElement(null, new File("conf/server.conf"));
+    new FileSystemResource().getFileElement(null, new File("conf/ext/server.conf"));
   }
 
   @Test(expected = NullPointerException.class)
-- 
GitLab