diff --git a/akka-bbb-apps/build.sbt b/akka-bbb-apps/build.sbt
index 1c179823475c29b0546468115f77a48e5c5a8a33..c15978841523962b05d44476b34659490459637e 100755
--- a/akka-bbb-apps/build.sbt
+++ b/akka-bbb-apps/build.sbt
@@ -70,6 +70,6 @@ daemonUser in Linux := user
 // group which will execute the application
 daemonGroup in Linux := group
 
-javaOptions in Universal ++= Seq("-J-Xms130m", "-J-Xmx256m", "-Dconfig.file=conf/application.conf", "-Dlogback.configurationFile=conf/logback.xml")
+javaOptions in Universal ++= Seq("-J-Xms130m", "-J-Xmx256m", "-Dconfig.file=/etc/bigbluebutton/bbb-apps-akka.conf", "-Dlogback.configurationFile=conf/logback.xml")
 
 debianPackageDependencies in Debian ++= Seq("java8-runtime-headless", "bash")
diff --git a/akka-bbb-apps/src/debian/DEBIAN/postinst b/akka-bbb-apps/src/debian/DEBIAN/postinst
deleted file mode 100644
index 5a4b7447f6dca69c06f7eca41fcff8b4a80bdac6..0000000000000000000000000000000000000000
--- a/akka-bbb-apps/src/debian/DEBIAN/postinst
+++ /dev/null
@@ -1,8 +0,0 @@
-if [ -f /tmp/application.conf ]; then
-  for KEY in bbbWebAPI sharedSecret; do
-    VALUE=$(grep $KEY /tmp/application.conf | sed 's/[^=]*=//')
-    if [ ! -z "$VALUE" ]; then
-      sed -i "/$KEY/s|=.*|=$VALUE|" /usr/share/bbb-apps-akka/conf/application.conf
-    fi
-  done
-fi
diff --git a/akka-bbb-apps/src/debian/DEBIAN/postrm b/akka-bbb-apps/src/debian/DEBIAN/postrm
new file mode 100644
index 0000000000000000000000000000000000000000..6df48c46fd4f2cc2438c0d0dbfacca840956a660
--- /dev/null
+++ b/akka-bbb-apps/src/debian/DEBIAN/postrm
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+  purge)
+    # remove config file added/changed by preinst script
+    OP_CONFIG=/etc/bigbluebutton/bbb-apps-akka.conf
+    if [ -f "${OP_CONFIG}" ]; then
+      rm "${OP_CONFIG}"
+    fi
+esac
diff --git a/akka-bbb-apps/src/debian/DEBIAN/preinst b/akka-bbb-apps/src/debian/DEBIAN/preinst
index c9549bd4e2e3658655c502c887b6bf9cbe95c436..1a03cc8dd0c8380508eaa472669cf4db8eabde9b 100644
--- a/akka-bbb-apps/src/debian/DEBIAN/preinst
+++ b/akka-bbb-apps/src/debian/DEBIAN/preinst
@@ -1,10 +1,38 @@
+#!/bin/sh
+
+write_config_file() {
+  mkdir -p /etc/bigbluebutton
+
+        cat <<END > "${OP_CONFIG}"
+// include default config from upstream
+include "/usr/share/bbb-apps-akka/conf/application.conf"
+
+// you can customize everything here. API endpoint and secret have to be changed
+// This file will not be overridden by packages
+
+services {
+  bbbWebAPI=${API}
+  sharedSecret=${SECRET}
+}
+END
+}
+
 case "$1" in
   install|upgrade|1|2)
 
-    rm -f /tmp/application.conf
-    if [ -f /usr/share/bbb-apps-akka/conf/application.conf ]; then
-      cp /usr/share/bbb-apps-akka/conf/application.conf /tmp/application.conf
+    PACKAGE_CONFIG=/usr/share/bbb-apps-akka/conf/application.conf
+    OP_CONFIG=/etc/bigbluebutton/bbb-apps-akka.conf
+    # this is for upgrading packages from old packaging system where operators had
+    # to change the package config file
+    if [ ! -f "${OP_CONFIG}" -a -f "${PACKAGE_CONFIG}" ]; then
+      API=$(grep bbbWebAPI "${PACKAGE_CONFIG}"  | sed 's/[^=]*=\s*//')
+      SECRET=$(grep sharedSecret "${PACKAGE_CONFIG}"  | sed 's/[^=]*=\s*//')
+      write_config_file
+    fi
+    # this is for fresh installs, where no config file exists
+    if [ ! -f "${OP_CONFIG}" ]; then
+      SECRET='"changeme"'
+      API='"https://192.168.23.33/bigbluebutton/api"'
+      write_config_file
     fi
-
-  ;;
 esac