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

fix(conf): start a new line for each domain to whitelist

When generating the domain list for the option `sso/client_whitelist`,
the line break is taken into account to create a real list of URLs.
This commit is contained in:
François Magimel 2022-09-10 15:39:56 +02:00
parent 82a802144a
commit e53b469ff1
5 changed files with 14 additions and 6 deletions

View file

@ -51,7 +51,7 @@ install_sources() {
else else
pip3 install --upgrade setuptools wheel pip pip3 install --upgrade setuptools wheel pip
fi fi
chown $synapse_user:root -R $final_path chown $synapse_user:root -R $final_path
sudo -u $synapse_user env PATH=$PATH pip3 install --upgrade 'cryptography>=3.4.7' sudo -u $synapse_user env PATH=$PATH pip3 install --upgrade 'cryptography>=3.4.7'
pip3 install --upgrade cffi ndg-httpsclient psycopg2 lxml jinja2 pip3 install --upgrade cffi ndg-httpsclient psycopg2 lxml jinja2
@ -71,6 +71,6 @@ install_sources() {
get_domain_list() { get_domain_list() {
yunohost --output-as plain domain list | grep -E "^#" -v | sort | uniq | while read domain; do yunohost --output-as plain domain list | grep -E "^#" -v | sort | uniq | while read domain; do
echo -n " - https://$domain\n" echo -n " - https://$domain\n"
done done
} }

View file

@ -49,7 +49,8 @@ synapse_db_name="matrix_$app"
synapse_db_user="matrix_$app" synapse_db_user="matrix_$app"
synapse_db_name="matrix_$app" synapse_db_name="matrix_$app"
upstream_version=$(ynh_app_upstream_version) upstream_version=$(ynh_app_upstream_version)
domain_whitelist_client=$(get_domain_list) domain_whitelist_client_=$(get_domain_list)
domain_whitelist_client=${domain_whitelist_client_%"\n"}
# Check if the new path stay /_matrix if not exit # Check if the new path stay /_matrix if not exit
@ -113,6 +114,7 @@ else
sso_enabled=False sso_enabled=False
fi fi
ynh_replace_string __DOMAIN_WHITELIST_CLIENT__ "$domain_whitelist_client" $YNH_APP_BASEDIR/conf/homeserver.yaml
ynh_add_config --template="homeserver.yaml" --destination="/etc/matrix-$app/homeserver.yaml" ynh_add_config --template="homeserver.yaml" --destination="/etc/matrix-$app/homeserver.yaml"
ynh_add_config --template="log.yaml" --destination="/etc/matrix-$app/log.yaml" ynh_add_config --template="log.yaml" --destination="/etc/matrix-$app/log.yaml"

View file

@ -27,7 +27,8 @@ is_free_registration=$(ynh_app_setting_get --app $app --key is_free_registration
jitsi_server=$(ynh_app_setting_get --app=$app --key=jitsi_server) jitsi_server=$(ynh_app_setting_get --app=$app --key=jitsi_server)
e2e_enabled_by_default=$(ynh_app_setting_get --app=$app --key=e2e_enabled_by_default) e2e_enabled_by_default=$(ynh_app_setting_get --app=$app --key=e2e_enabled_by_default)
synapse_user_app_pwd=$(ynh_app_setting_get --app=$app --key=synapse_user_app_pwd) synapse_user_app_pwd=$(ynh_app_setting_get --app=$app --key=synapse_user_app_pwd)
domain_whitelist_client=$(get_domain_list) domain_whitelist_client_=$(get_domain_list)
domain_whitelist_client=${domain_whitelist_client_%"\n"}
main_domain=$(yunohost domain list --output-as json | jq -r .main) main_domain=$(yunohost domain list --output-as json | jq -r .main)
#================================================= #=================================================
@ -136,6 +137,7 @@ apply_config() {
sso_enabled=False sso_enabled=False
fi fi
ynh_replace_string __DOMAIN_WHITELIST_CLIENT__ "$domain_whitelist_client" $YNH_APP_BASEDIR/conf/homeserver.yaml
ynh_add_config --template="homeserver.yaml" --destination="/etc/matrix-$app/homeserver.yaml" ynh_add_config --template="homeserver.yaml" --destination="/etc/matrix-$app/homeserver.yaml"
ynh_add_config --template="log.yaml" --destination="/etc/matrix-$app/log.yaml" ynh_add_config --template="log.yaml" --destination="/etc/matrix-$app/log.yaml"

View file

@ -36,7 +36,8 @@ report_stats="false"
allow_public_rooms="false" allow_public_rooms="false"
e2e_enabled_by_default="true" e2e_enabled_by_default="true"
default_domain_value="Same than the domain" default_domain_value="Same than the domain"
domain_whitelist_client=$(get_domain_list) domain_whitelist_client_=$(get_domain_list)
domain_whitelist_client=${domain_whitelist_client_%"\n"}
#================================================= #=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST # RETRIEVE ARGUMENTS FROM THE MANIFEST
@ -277,6 +278,7 @@ else
sso_enabled=False sso_enabled=False
fi fi
ynh_replace_string __DOMAIN_WHITELIST_CLIENT__ "$domain_whitelist_client" $YNH_APP_BASEDIR/conf/homeserver.yaml
ynh_add_config --template="homeserver.yaml" --destination="/etc/matrix-$app/homeserver.yaml" ynh_add_config --template="homeserver.yaml" --destination="/etc/matrix-$app/homeserver.yaml"
ynh_add_config --template="log.yaml" --destination="/etc/matrix-$app/log.yaml" ynh_add_config --template="log.yaml" --destination="/etc/matrix-$app/log.yaml"

View file

@ -41,7 +41,8 @@ registration_shared_secret=$(ynh_app_setting_get --app=$app --key=registration_s
form_secret=$(ynh_app_setting_get --app=$app --key=form_secret) form_secret=$(ynh_app_setting_get --app=$app --key=form_secret)
macaroon_secret_key=$(ynh_app_setting_get --app=$app --key=macaroon_secret_key) macaroon_secret_key=$(ynh_app_setting_get --app=$app --key=macaroon_secret_key)
synapse_user_app_pwd=$(ynh_app_setting_get --app=$app --key=synapse_user_app_pwd) synapse_user_app_pwd=$(ynh_app_setting_get --app=$app --key=synapse_user_app_pwd)
domain_whitelist_client=$(get_domain_list) domain_whitelist_client_=$(get_domain_list)
domain_whitelist_client=${domain_whitelist_client_%"\n"}
main_domain=$(yunohost domain list --output-as json | jq -r .main) main_domain=$(yunohost domain list --output-as json | jq -r .main)
#================================================= #=================================================
@ -249,6 +250,7 @@ else
sso_enabled=False sso_enabled=False
fi fi
ynh_replace_string __DOMAIN_WHITELIST_CLIENT__ "$domain_whitelist_client" "$YNH_APP_BASEDIR/conf/homeserver.yaml"
ynh_add_config --template="homeserver.yaml" --destination="/etc/matrix-$app/homeserver.yaml" ynh_add_config --template="homeserver.yaml" --destination="/etc/matrix-$app/homeserver.yaml"
ynh_add_config --template="log.yaml" --destination="/etc/matrix-$app/log.yaml" ynh_add_config --template="log.yaml" --destination="/etc/matrix-$app/log.yaml"