[paste-web/oscp] Better handling of the database.php variables



commit ef961bc80adeca3a500ece0081eb0a7f6447bff1
Author: Andrea Veri <averi redhat com>
Date:   Tue Oct 23 16:56:25 2018 +0200

    Better handling of the database.php variables

 Dockerfile                           |  1 +
 entrypoint.sh                        |  8 ++++----
 patches/add_database_variables.patch | 18 ++++++++++++++++++
 3 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/Dockerfile b/Dockerfile
index cee5ab5..c8f52ec 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -33,6 +33,7 @@ RUN patch -p0 < /tmp/patches/uniform_variables_site.patch
 RUN patch -p0 < /tmp/patches/uniform_variables_view.patch
 RUN patch -p0 < /tmp/patches/update_app_config_php7.patch
 RUN patch -p0 < /tmp/patches/gnome_ldap_customizations.patch
+RUN patch -p0 < /tmp/patches/add_database_variables.patch
 
 RUN chown -R 1001:root /var/www/html && \
     find /var/www/html -type d -print0 | xargs -0 chmod 775 && \
diff --git a/entrypoint.sh b/entrypoint.sh
index 97061a4..17f5bf0 100755
--- a/entrypoint.sh
+++ b/entrypoint.sh
@@ -1,9 +1,9 @@
 #!/bin/bash
 
-sed -i "s/localhost/${PASTE_DATABASE_HOST}/" /var/www/html/paste.gnome.org/app/config/database.php
-sed -i "s/database/${PASTE_DATABASE_NAME}/" /var/www/html/paste.gnome.org/app/config/database.php
-sed -i "s/root/${PASTE_DATABASE_USER}/" /var/www/html/paste.gnome.org/app/config/database.php
-sed -i "s/ /${PASTE_DATABASE_PASSWORD}/" /var/www/html/paste.gnome.org/app/config/database.php
+sed -i "s/PASTE_DATABASE_HOST/${PASTE_DATABASE_HOST}/" /var/www/html/paste.gnome.org/app/config/database.php
+sed -i "s/PASTE_DATABASE_NAME/${PASTE_DATABASE_NAME}/" /var/www/html/paste.gnome.org/app/config/database.php
+sed -i "s/PASTE_DATABASE_USER/${PASTE_DATABASE_USER}/" /var/www/html/paste.gnome.org/app/config/database.php
+sed -i "s/PASTE_DATABASE_PASSWORD/${PASTE_DATABASE_PASSWORD}/" 
/var/www/html/paste.gnome.org/app/config/database.php
 
 exec httpd -DFOREGROUND
 
diff --git a/patches/add_database_variables.patch b/patches/add_database_variables.patch
new file mode 100644
index 0000000..7ff9b41
--- /dev/null
+++ b/patches/add_database_variables.patch
@@ -0,0 +1,18 @@
+--- app/config/database.php.orig       2018-10-23 16:52:17.244817865 +0200
++++ app/config/database.php    2018-10-23 16:54:22.248309074 +0200
+@@ -54,10 +54,10 @@
+ 
+               'mysql' => array(
+                       'driver'    => 'mysql',
+-                      'host'      => 'localhost',
+-                      'database'  => 'database',
+-                      'username'  => 'root',
+-                      'password'  => '',
++                      'host'      => 'PASTE_DATABASE_HOST',
++                      'database'  => 'PASTE_DATABASE_NAME',
++                      'username'  => 'PASTE_DATABASE_USER',
++                      'password'  => 'PASTE_DATABASE_PASSWORD',
+                       'charset'   => 'utf8',
+                       'collation' => 'utf8_unicode_ci',
+                       'prefix'    => '',
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]