1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/distbin_ynh.git synced 2024-09-03 18:26:10 +02:00

Fix domain uri ending /

This commit is contained in:
yalh76 2019-03-20 00:29:35 +01:00
parent dda280bc06
commit 86c722e03e
2 changed files with 16 additions and 3 deletions

View file

@ -103,7 +103,15 @@ ynh_systemd_action --action=stop --service_name=$app
#================================================= #=================================================
# Change the URL in the configuration file # Change the URL in the configuration file
ynh_replace_string "EXTERNAL_URL=.*" "EXTERNAL_URL=https://$new_domain$new_path" "$final_path/.env"
if [ "$new_path" = "/" ]
then
new_domain_uri="$domain$path_url"
else
new_domain_uri="$domain"
fi
ynh_replace_string "EXTERNAL_URL=.*" "EXTERNAL_URL=https://$new_domain_uri/" "$final_path/.env"
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. ### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. ### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
@ -117,7 +125,6 @@ ynh_store_file_checksum "$final_path/.env"
ynh_systemd_action --action=start --service_name=$app ynh_systemd_action --action=start --service_name=$app
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION
#================================================= #=================================================

View file

@ -196,10 +196,16 @@ ynh_add_systemd_config
### (It's compatible with sed regular expressions syntax) ### (It's compatible with sed regular expressions syntax)
cp "../conf/.env" "$final_path/.env" cp "../conf/.env" "$final_path/.env"
if [ "$path_url" = "/" ]
then
domain_uri="$domain"
else
domain_uri="$domain$path_url"
fi
ynh_replace_string "__NODEJS_PATH__" "$nodejs_path" "$final_path/.env" ynh_replace_string "__NODEJS_PATH__" "$nodejs_path" "$final_path/.env"
ynh_replace_string "__PORT__" "$port" "$final_path/.env" ynh_replace_string "__PORT__" "$port" "$final_path/.env"
ynh_replace_string "__DOMAIN_URI__" "$domain$path_url" "$final_path/.env" ynh_replace_string "__DOMAIN_URI__" "$domain_uri" "$final_path/.env"
ynh_replace_string "__FINALPATH__" "$final_path" "$final_path/.env" ynh_replace_string "__FINALPATH__" "$final_path" "$final_path/.env"
#================================================= #=================================================