diff --git a/scripts/backup b/scripts/backup index a0c8e93..c7c8497 100755 --- a/scripts/backup +++ b/scripts/backup @@ -26,7 +26,8 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) -database=$(ynh_app_setting_get --app=$app --key=database) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP diff --git a/scripts/install b/scripts/install index da526c3..edbead6 100755 --- a/scripts/install +++ b/scripts/install @@ -103,6 +103,7 @@ ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencie ynh_script_progression --message="Configuring Kimai2..." --weight=1 local_conf="$final_path/config/packages/local.yaml" + # Configure registration cp ../conf/local.yaml $local_conf ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$local_conf" @@ -112,27 +113,9 @@ then else ynh_replace_string --match_string="__REGISTRATION__" --replace_string="false" --target_file="$local_conf" fi +ynh_store_file_checksum --file="$local_conf" -env_conf="$final_path/.env" -# Configure environement -if [ "$database" = "mysql" ]; then - # setup application config - cp ../conf/.env.mysql $env_conf - db_name=$(ynh_sanitize_dbid --db_name=$app) - db_user=$db_name - ynh_app_setting_set --app=$app --key=db_name --value=$db_name - ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name - ynh_replace_string --match_string="__RANDOM_KEY__" --replace_string="$random_key" --target_file="$env_conf" - ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$env_conf" - ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$env_conf" - ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_name" --target_file="$env_conf" - ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$env_conf" -else - # setup application config - cp ../conf/.env.sqlite $env_conf - ynh_replace_string --match_string="__RANDOM_KEY__" --replace_string="$random_key" --target_file="$env_conf" - ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$env_conf" -fi +ynh_add_config --template="../conf/.env.mysql" --destination="$final_path/.env" #================================================= # BUILD KIMAI2 @@ -146,15 +129,6 @@ pushd "$final_path" php${YNH_PHP_VERSION} bin/console kimai:install -n popd -#================================================= -# STORE THE CONFIG FILE CHECKSUM -#================================================= -ynh_script_progression --message="Storing the config file checksum..." --weight=1 - -# Calculate and store the config file checksum into the app settings -ynh_store_file_checksum --file="$local_conf" -ynh_store_file_checksum --file="$env_conf" - #================================================= # GENERIC FINALIZATION #=================================================