1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/kanboard_ynh.git synced 2024-09-03 19:36:17 +02:00

Simplify config

This commit is contained in:
ericgaspar 2021-02-26 12:26:48 +01:00
parent ef1b2c3aa5
commit b1247f5df2
No known key found for this signature in database
GPG key ID: 574F281483054D44
4 changed files with 24 additions and 44 deletions

View file

@ -183,7 +183,7 @@ define('REVERSE_PROXY_AUTH', true);
define('REVERSE_PROXY_USER_HEADER', 'REMOTE_USER');
// Username of the admin, by default blank
define('REVERSE_PROXY_DEFAULT_ADMIN', '__USER__');
define('REVERSE_PROXY_DEFAULT_ADMIN', '__ADMIN__');
// Default domain to use for setting the email address
define('REVERSE_PROXY_DEFAULT_DOMAIN', '__DOMAIN__');

View file

@ -14,7 +14,7 @@
"email": "apps@yunohost.org"
},
"requirements": {
"yunohost": ">= 3.8.1"
"yunohost": ">= 4.0.0"
},
"previous_maintainers": [{
"name": "mbugeia",
@ -27,7 +27,7 @@
"multi_instance": true,
"services": [
"nginx",
"php7.0-fpm",
"php7.3-fpm",
"mysql"
],
"arguments": {

View file

@ -23,6 +23,7 @@ domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
email=$(ynh_user_get_info --username=$admin --key=mail)
app=$YNH_APP_INSTANCE_NAME
@ -45,7 +46,6 @@ ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=adminusername --value=$admin
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
#=================================================
# STANDARD MODIFICATIONS
@ -101,18 +101,10 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
ynh_script_progression --message="Configuring Kanboard..."
# Retrieve admin email
email=$(ynh_user_get_info --username=$admin --key=mail)
# Copy and edit config.php
config_php="${final_path}/config.php"
config_php="$final_path/config.php"
cp ../conf/config.php "$config_php"
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config_php"
ynh_replace_string --match_string="__DB_NAME__" --replace_string=$db_name --target_file="$config_php"
ynh_replace_string --match_string="__USER__" --replace_string=$admin --target_file="$config_php"
ynh_replace_string --match_string="__EMAIL__" --replace_string=$email --target_file="$config_php"
ynh_replace_string --match_string="__DOMAIN__" --replace_string=$domain --target_file="$config_php"
ynh_add_config --template="../conf/config.php" --destination="$config_php"
#=================================================
# DATABASE INITIALIZATION
@ -120,11 +112,11 @@ ynh_replace_string --match_string="__DOMAIN__" --replace_string=$domain --targ
ynh_script_progression --message="Initializing database..." --weight=7
ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" < "${final_path}/app/Schema/Sql/mysql.sql"
(
cd "$final_path"
pushd $final_path
# Launch database migration
php$YNH_PHP_VERSION cli db:migrate --no-interaction --verbose
)
php$phpversion cli db:migrate --no-interaction --verbose
popd
#=================================================
# GENERIC FINALIZATION
@ -147,12 +139,10 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-error.log" --failregex
#=================================================
# SETUP CRON
#=================================================
ynh_script_progression --message="Setuping a cron..."
ynh_script_progression --message="Setuping a cron..." --weight=1
ynh_add_config --template="../conf/cron_kanboard" --destination="$/etc/cron.d/$app"
cp ../conf/cron_kanboard /etc/cron.d/$app
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path/" --target_file="/etc/cron.d/$app"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/cron.d/$app"
ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion" --target_file="/etc/cron.d/$app"
chmod 644 "/etc/cron.d/$app"
#=================================================
@ -178,7 +168,7 @@ ynh_store_file_checksum --file="$config_php"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload

View file

@ -22,7 +22,9 @@ admin=$(ynh_app_setting_get --app=$app --key=adminusername)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
email=$(ynh_user_get_info --username=$admin --key=mail)
#=================================================
# CHECK VERSION
@ -117,34 +119,24 @@ ynh_add_fpm_config --package="$extra_php_dependencies"
#=================================================
ynh_script_progression --message="Reconfiguring Kanboard..." --weight=2
# Retrieve admin email
email=$(ynh_user_get_info --username=$admin --key=mail)
# Copy and edit config.php
config_php="${final_path}/config.php"
config_php="$final_path/config.php"
ynh_backup_if_checksum_is_different --file="$config_php"
cp ../conf/config.php "$config_php"
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config_php"
ynh_replace_string --match_string="__DB_NAME__" --replace_string=$db_name --target_file="$config_php"
ynh_replace_string --match_string="__USER__" --replace_string=$admin --target_file="$config_php"
ynh_replace_string --match_string="__EMAIL__" --replace_string=$email --target_file="$config_php"
ynh_replace_string --match_string="__DOMAIN__" --replace_string=$domain --target_file="$config_php"
ynh_add_config --template="../conf/config.php" --destination="$config_php"
#=================================================
# UPGRADE KANBOARD
#=================================================
ynh_script_progression --message="Upgrading Kanboard..." --weight=2
(
cd "$final_path"
pushd $final_path
# Launch database migration
php$YNH_PHP_VERSION cli db:migrate --no-interaction --verbose
php$phpversion cli db:migrate --no-interaction --verbose
# Launch plugins migration
php$YNH_PHP_VERSION cli plugin:upgrade --no-interaction --verbose
)
php$phpversion cli plugin:upgrade --no-interaction --verbose
popd
#=================================================
# GENERIC FINALIZATION
@ -169,10 +161,8 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-error.log" --failregex
#=================================================
ynh_script_progression --message="Setuping a cron..."
cp ../conf/cron_kanboard /etc/cron.d/$app
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path/" --target_file="/etc/cron.d/$app"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/cron.d/$app"
ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion" --target_file="/etc/cron.d/$app"
ynh_add_config --template="../conf/cron_kanboard" --destination="$/etc/cron.d/$app"
chmod 644 "/etc/cron.d/$app"
#=================================================