1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/kimai2_ynh.git synced 2024-09-03 19:26:26 +02:00
This commit is contained in:
ericgaspar 2021-09-27 11:05:00 +02:00
parent 5854353e67
commit 884ab0ccf2
No known key found for this signature in database
GPG key ID: 574F281483054D44
2 changed files with 5 additions and 30 deletions

View file

@ -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

View file

@ -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
#=================================================