#!/bin/bash source _common.sh source /usr/share/yunohost/helpers #================================================= # MODIFY URL IN NGINX CONF #================================================= ynh_script_progression "Updating NGINX web server configuration..." ynh_config_change_url_nginx #================================================= # SPECIFIC MODIFICATIONS #================================================= ynh_script_progression "Applying $app specific modifications..." # Define a function to execute commands with `occ` exec_occ() { (cd "$install_dir" && ynh_exec_as_app \ php${php_version} --define apc.enable_cli=1 occ --no-interaction --no-ansi "$@") } if [ $change_domain -eq 1 ] then # Change the trusted domain exec_occ config:system:set trusted_domains 1 --value=$new_domain # Change hostname for activity notifications exec_occ config:system:set overwrite.cli.url --value="https://${new_domain}${new_path}" # Reload php fpm, necessary for force nextcloud to re-read config.php, cf opcache.revalidate_freq ynh_systemctl --service=php${php_version}-fpm --action=reload # Check if .well-known is available for this domain if is_url_handled --domain="$new_domain" --path="/.well-known/caldav" || is_url_handled --domain="$new_domain" --path="/.well-known/carddav" then ynh_print_warn "Another app already uses the domain $new_domain to serve a CalDAV/CardDAV feature. You may encounter issues when dealing with your calendar or address book." # Remove lines about .well-known/carddav and caldav with sed. sed --in-place --regexp-extended '/location = \/\.well\-known\/(caldav|carddav)/d' "/etc/nginx/conf.d/$new_domain.d/$app.conf" ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf" fi fi #================================================= # SETUP SSOWAT #================================================= ynh_script_progression "Configuring permissions..." # Temporary fix for the API permission (workaround for https://github.com/YunoHost/issues/issues/2294 ) ynh_permission_url --permission="api" --url="re:$new_domain\/.well-known\/.*" --auth_header="false" --clear_urls #================================================= # END OF SCRIPT #================================================= ynh_script_progression "Change of URL completed for $app"