From d3024acd1057c1741571fb0fafc8e8a1c30c118e Mon Sep 17 00:00:00 2001 From: anmol26s Date: Sun, 7 Oct 2018 05:40:48 +0530 Subject: [PATCH] Add domain for mail in .env --- conf/.env | 5 +++-- scripts/install | 4 +++- scripts/upgrade | 24 ++++++++++++++++++++++-- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/conf/.env b/conf/.env index 9399233..7ac7eef 100644 --- a/conf/.env +++ b/conf/.env @@ -4,10 +4,11 @@ # KIMAI DEFAULT ENV VARS DATABASE_PREFIX=kimai2_ +MAILER_FROM=admin@__DOMAIN__ ###> symfony/framework-bundle ### APP_ENV=prod -APP_SECRET=random_key +APP_SECRET=__RANDOM_KEY__ #TRUSTED_PROXIES=127.0.0.1,127.0.0.2 #TRUSTED_HOSTS=localhost,example.com ###< symfony/framework-bundle ### @@ -16,7 +17,7 @@ APP_SECRET=random_key # Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url # For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data/kimai.sqlite" # Configure your db driver and server_version in config/packages/doctrine.yaml -#DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name +# DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name DATABASE_URL=sqlite:///%kernel.project_dir%/var/data/kimai.sqlite ###< doctrine/doctrine-bundle ### diff --git a/scripts/install b/scripts/install index 9036037..65335a6 100755 --- a/scripts/install +++ b/scripts/install @@ -121,7 +121,9 @@ sudo cp ../conf/.env $final_path/.env #================================================= # MODIFY A CONFIG FILE #================================================= -ynh_replace_string "random_key" "$random_key" "$final_path/.env" +ynh_replace_string "__RANDOM_KEY__" "$random_key" "$final_path/.env" +ynh_replace_string "__DOMAIN__" "$domain" "$final_path/.env" + init_composer $final_path cd $final_path && sudo /usr/bin/php7.2 bin/console doctrine:schema:create diff --git a/scripts/upgrade b/scripts/upgrade index 3348793..0781dee 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -83,7 +83,12 @@ version=`cd /var/www/$app && bin/console kimai:version --short 2> /dev/null || s # Create a temporary directory tmpdir="$(mktemp -d)" # Backup the config file in the temp dir -cp -a "$final_path/.env" "$tmpdir/." +if [ -f $final_path/config/packages/local.yaml ]; then + cp -af "$final_path/config/packages/local.yaml" "$tmpdir/." +fi +if [ -d $final_path/var/invoices ]; then + cp -af "$final_path/var/invoices" "$tmpdir/." +fi cp -a "$final_path/var/data/kimai.sqlite" "$tmpdir/." ynh_setup_source "$final_path" @@ -97,9 +102,24 @@ then fi ynh_secure_remove "$final_path" ynh_setup_source "$final_path" -sudo cp -a "$tmpdir/.env" "$final_path/." +if [ -f $tmpdir/local.yaml ]; then + cp -af "$tmpdir/local.yaml" "$final_path/config/packages/." +fi +if [ -d $tmpdir/invoices ]; then + cp -af "$tmpdir/invoices" "$final_path/var/." +fi sudo cp -af "$tmpdir/kimai.sqlite" "$final_path/var/data/." sudo rm -Rf "$tmpdir" + +# setup application config +sudo cp ../conf/.env $final_path/.env + +#================================================= +# MODIFY A CONFIG FILE +#================================================= +ynh_replace_string "__RANDOM_KEY__" "$random_key" "$final_path/.env" +ynh_replace_string "__DOMAIN__" "$domain" "$final_path/.env" + init_composer $final_path ( cd $final_path && sudo /usr/bin/php7.2 bin/console cache:clear --env=prod