update-app-php.sh 1.48 KB
#!/bin/bash

cp -p ../config/app.php ../config/app.php.ORIG
cp ../config/app.default.php ../config/app.php

username=$(grep "/\*d\*/'username'" ../config/app.php.ORIG | cut -d"'" -f4)
password=$(grep "/\*d\*/'password'" ../config/app.php.ORIG | cut -d"'" -f4)
database=$(grep "/\*d\*/'database'" ../config/app.php.ORIG | cut -d"'" -f4)
host=$(grep "/\*d\*/'host'" ../config/app.php.ORIG | cut -d"'" -f4)

usernameTEST=$(grep "/\*t\*/'username'" ../config/app.php.ORIG | cut -d"'" -f4)
passwordTEST=$(grep "/\*t\*/'password'" ../config/app.php.ORIG | cut -d"'" -f4)
databaseTEST=$(grep "/\*t\*/'database'" ../config/app.php.ORIG | cut -d"'" -f4)
hostTEST=$(grep "/\*t\*/'host'" ../config/app.php.ORIG | cut -d"'" -f4)

sed -e "s/'database' => 'database'/'database' => '$database'/" -i ../config/app.php
sed -e "s/'username' => 'username'/'username' => '$username'/" -i ../config/app.php
sed -e "s/'password' => 'password'/'password' => '$password'/" -i ../config/app.php
sed -e "s/'host' => 'localhost'/'host' => '$host'/" -i ../config/app.php

sed -e "s/'database' => 'test_database'/'database' => '$databaseTEST'/" -i ../config/app.php
sed -e "s/'username' => 'test_username'/'username' => '$usernameTEST'/" -i ../config/app.php
sed -e "s/'password' => 'test_password'/'password' => '$passwordTEST'/" -i ../config/app.php
sed -e "s/'host' => 'localhost'/'host' => '$hostTEST'/" -i ../config/app.php

sed -e "s/'debug' => filter_var(env('DEBUG', true/'debug' => filter_var(env('DEBUG', false/" -i ../config/app.php