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:
parent
ac3218a316
commit
028784a902
1 changed files with 31 additions and 19 deletions
|
@ -12,7 +12,6 @@ source /usr/share/yunohost/helpers
|
|||
ynh_abort_if_errors
|
||||
|
||||
# Import common fonctions
|
||||
source ./psql.sh
|
||||
source ./experimental_helper.sh
|
||||
source ./_common.sh
|
||||
|
||||
|
@ -21,6 +20,10 @@ source ./_common.sh
|
|||
#=================================================
|
||||
|
||||
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
|
||||
|
@ -29,17 +32,16 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
show_config() {
|
||||
# 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_SYNAPSE_CONFIG_SERVER_CONFIG_SERVER_STATISTICS=$(ynh_app_setting_get --app $app --key 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_SERVER_STATISTICS=$report_stats"
|
||||
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 ]]
|
||||
then
|
||||
echo "YNH_CONFIG_PACKAGE_CONFIG_PACKAGE_CONFIG_BACKUP_BEFORE_UPGRADE=False"
|
||||
else
|
||||
echo "YNH_CONFIG_PACKAGE_CONFIG_PACKAGE_CONFIG_BACKUP_BEFORE_UPGRADE=True"
|
||||
fi
|
||||
is_public=$(ynh_app_setting_get --app $app --key is_public)
|
||||
|
||||
if [[ ${is_public} -eq 1 ]]
|
||||
then
|
||||
echo "YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_IS_PUBLIC=False"
|
||||
|
@ -53,21 +55,31 @@ show_config() {
|
|||
#=================================================
|
||||
|
||||
apply_config() {
|
||||
ynh_app_setting_set --app $app --key report_stats --value $YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_SERVER_STATISTICS
|
||||
ynh_app_setting_set --app $app --key allow_public_rooms --value $YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_ALLOW_PUBLIC_ROOMS
|
||||
report_stats=${YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_SERVER_STATISTICS:-$report_stats}
|
||||
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,,}
|
||||
then
|
||||
ynh_app_setting_set --app $app --key disable_backup_before_upgrade --value 0
|
||||
else
|
||||
ynh_app_setting_set --app $app --key disable_backup_before_upgrade --value 1
|
||||
ynh_app_setting_set --app $app --key report_stats --value $report_stats
|
||||
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
|
||||
backup_before_upgrade=0
|
||||
else
|
||||
ynh_app_setting_set --app $app --key disable_backup_before_upgrade --value 1
|
||||
backup_before_upgrade=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if ${YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_IS_PUBLIC,,}
|
||||
then
|
||||
ynh_app_setting_set --app $app --key is_public --value 1
|
||||
else
|
||||
ynh_app_setting_set --app $app --key is_public --value 0
|
||||
if [ -n "${YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_IS_PUBLIC:-}" ]; then
|
||||
if ${YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_IS_PUBLIC,,}
|
||||
then
|
||||
ynh_app_setting_set --app $app --key is_public --value 1
|
||||
is_public=1
|
||||
else
|
||||
ynh_app_setting_set --app $app --key is_public --value 0
|
||||
is_public=0
|
||||
fi
|
||||
fi
|
||||
|
||||
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)
|
||||
registration_shared_secret=$(ynh_app_setting_get --app $app --key registration_shared_secret)
|
||||
form_secret=$(ynh_app_setting_get --app $app --key form_secret)
|
||||
report_stats=$(ynh_app_setting_get --app $app --key report_stats)
|
||||
allow_public_rooms=$(ynh_app_setting_get --app=$app --key=allow_public_rooms)
|
||||
macaroon_secret_key=$(ynh_app_setting_get --app=$app --key=macaroon_secret_key)
|
||||
|
||||
synapse_user="matrix-$app"
|
||||
synapse_db_name="matrix_$app"
|
||||
synapse_db_user="matrix_$app"
|
||||
|
|
Loading…
Reference in a new issue