1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/synapse_ynh.git synced 2024-09-03 20:26:38 +02:00

Fix config pannel

This commit is contained in:
Josué Tille 2019-11-13 21:39:22 +01:00
parent ac3218a316
commit 028784a902
No known key found for this signature in database
GPG key ID: 716A6C99B04194EF

View file

@ -12,7 +12,6 @@ source /usr/share/yunohost/helpers
ynh_abort_if_errors ynh_abort_if_errors
# Import common fonctions # Import common fonctions
source ./psql.sh
source ./experimental_helper.sh source ./experimental_helper.sh
source ./_common.sh source ./_common.sh
@ -21,6 +20,10 @@ source ./_common.sh
#================================================= #=================================================
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
report_stats=$(ynh_app_setting_get --app $app --key report_stats)
allow_public_rooms=$(ynh_app_setting_get --app=$app --key=allow_public_rooms)
backup_before_upgrade=$(ynh_app_setting_get --app $app --key disable_backup_before_upgrade)
is_public=$(ynh_app_setting_get --app $app --key is_public)
#================================================= #=================================================
# SHOW_CONFIG FUNCTION FOR 'SHOW' COMMAND # SHOW_CONFIG FUNCTION FOR 'SHOW' COMMAND
@ -29,17 +32,16 @@ app=$YNH_APP_INSTANCE_NAME
show_config() { show_config() {
# here you are supposed to read some config file/database/other then print the values # here you are supposed to read some config file/database/other then print the values
# echo "YNH_CONFIG_${PANEL_ID}_${SECTION_ID}_${OPTION_ID}=value" # echo "YNH_CONFIG_${PANEL_ID}_${SECTION_ID}_${OPTION_ID}=value"
echo "YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_SERVER_STATISTICS=$(ynh_app_setting_get --app $app --key report_stats)" echo "YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_SERVER_STATISTICS=$report_stats"
echo "YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_ALLOW_PUBLIC_ROOMS=$(ynh_app_setting_get --app $app --key allow_public_rooms)" echo "YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_ALLOW_PUBLIC_ROOMS=$allow_public_rooms"
backup_before_upgrade=$(ynh_app_setting_get --app $app --key disable_backup_before_upgrade)
if [[ ${backup_before_upgrade:-0} -eq 1 ]] if [[ ${backup_before_upgrade:-0} -eq 1 ]]
then then
echo "YNH_CONFIG_PACKAGE_CONFIG_PACKAGE_CONFIG_BACKUP_BEFORE_UPGRADE=False" echo "YNH_CONFIG_PACKAGE_CONFIG_PACKAGE_CONFIG_BACKUP_BEFORE_UPGRADE=False"
else else
echo "YNH_CONFIG_PACKAGE_CONFIG_PACKAGE_CONFIG_BACKUP_BEFORE_UPGRADE=True" echo "YNH_CONFIG_PACKAGE_CONFIG_PACKAGE_CONFIG_BACKUP_BEFORE_UPGRADE=True"
fi fi
is_public=$(ynh_app_setting_get --app $app --key is_public)
if [[ ${is_public} -eq 1 ]] if [[ ${is_public} -eq 1 ]]
then then
echo "YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_IS_PUBLIC=False" echo "YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_IS_PUBLIC=False"
@ -53,21 +55,31 @@ show_config() {
#================================================= #=================================================
apply_config() { apply_config() {
ynh_app_setting_set --app $app --key report_stats --value $YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_SERVER_STATISTICS report_stats=${YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_SERVER_STATISTICS:-$report_stats}
ynh_app_setting_set --app $app --key allow_public_rooms --value $YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_ALLOW_PUBLIC_ROOMS allow_public_rooms=${YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_ALLOW_PUBLIC_ROOMS:-$allow_public_rooms}
if ${YNH_CONFIG_PACKAGE_CONFIG_PACKAGE_CONFIG_BACKUP_BEFORE_UPGRADE,,} ynh_app_setting_set --app $app --key report_stats --value $report_stats
then ynh_app_setting_set --app $app --key allow_public_rooms --value $allow_public_rooms
if [ -n "${YNH_CONFIG_PACKAGE_CONFIG_PACKAGE_CONFIG_BACKUP_BEFORE_UPGRADE:-}" ]; then
if ${YNH_CONFIG_PACKAGE_CONFIG_PACKAGE_CONFIG_BACKUP_BEFORE_UPGRADE,,}; then
ynh_app_setting_set --app $app --key disable_backup_before_upgrade --value 0 ynh_app_setting_set --app $app --key disable_backup_before_upgrade --value 0
backup_before_upgrade=0
else else
ynh_app_setting_set --app $app --key disable_backup_before_upgrade --value 1 ynh_app_setting_set --app $app --key disable_backup_before_upgrade --value 1
backup_before_upgrade=1
fi
fi fi
if [ -n "${YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_IS_PUBLIC:-}" ]; then
if ${YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_IS_PUBLIC,,} if ${YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_IS_PUBLIC,,}
then then
ynh_app_setting_set --app $app --key is_public --value 1 ynh_app_setting_set --app $app --key is_public --value 1
is_public=1
else else
ynh_app_setting_set --app $app --key is_public --value 0 ynh_app_setting_set --app $app --key is_public --value 0
is_public=0
fi
fi fi
domain=$(ynh_app_setting_get --app $app --key special_domain) domain=$(ynh_app_setting_get --app $app --key special_domain)
@ -80,8 +92,8 @@ apply_config() {
turnserver_pwd=$(ynh_app_setting_get --app $app --key turnserver_pwd) turnserver_pwd=$(ynh_app_setting_get --app $app --key turnserver_pwd)
registration_shared_secret=$(ynh_app_setting_get --app $app --key registration_shared_secret) registration_shared_secret=$(ynh_app_setting_get --app $app --key registration_shared_secret)
form_secret=$(ynh_app_setting_get --app $app --key form_secret) form_secret=$(ynh_app_setting_get --app $app --key form_secret)
report_stats=$(ynh_app_setting_get --app $app --key report_stats) macaroon_secret_key=$(ynh_app_setting_get --app=$app --key=macaroon_secret_key)
allow_public_rooms=$(ynh_app_setting_get --app=$app --key=allow_public_rooms)
synapse_user="matrix-$app" synapse_user="matrix-$app"
synapse_db_name="matrix_$app" synapse_db_name="matrix_$app"
synapse_db_user="matrix_$app" synapse_db_user="matrix_$app"