From e5f2973a56c5eacdd3bc419f5f4d7c37f12aaceb Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 17 Mar 2021 12:02:40 +0100 Subject: [PATCH] Simplify conf --- check_process | 1 - conf/config.js | 2 +- conf/nginx.conf | 6 ++++-- scripts/install | 23 ++++++++++++----------- scripts/upgrade | 18 ++++++++++-------- 5 files changed, 27 insertions(+), 23 deletions(-) diff --git a/check_process b/check_process index 26c6100..2afd349 100644 --- a/check_process +++ b/check_process @@ -15,7 +15,6 @@ upgrade=1 from_commit=ddbb3b36b8bcd00e573456bd9ad07b1aa5e41cb1 backup_restore=1 multi_instance=0 - incorrect_path=0 port_already_use=1 change_url=1 ;;; Options diff --git a/conf/config.js b/conf/config.js index c46d9ca..75f1ac9 100644 --- a/conf/config.js +++ b/conf/config.js @@ -142,7 +142,7 @@ module.exports = { /* CryptPad will display a point of contact for your instance on its contact page * (/contact.html) if you provide it below. */ - adminEmail: '__ADMIN_MAIL__', + adminEmail: '__EMAIL__', /* * By default, CryptPad contacts one of our servers once a day. diff --git a/conf/nginx.conf b/conf/nginx.conf index 6117882..d3e50e5 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,8 +1,10 @@ location ^~ / { - # Force usage of https - if ($scheme = http) { + + # Force usage of https + if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; } + proxy_pass http://127.0.0.1:__PORT__; proxy_redirect off; proxy_set_header Host $host; diff --git a/scripts/install b/scripts/install index 7399b7c..5ef1cd7 100644 --- a/scripts/install +++ b/scripts/install @@ -27,6 +27,7 @@ domain=$YNH_APP_ARG_DOMAIN is_public=$YNH_APP_ARG_IS_PUBLIC path_url="/" admin=$YNH_APP_ARG_ADMIN +email=$(ynh_user_get_info --username=$admin --key=mail) app=$YNH_APP_INSTANCE_NAME @@ -49,8 +50,6 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path_url --value=$path_url ynh_app_setting_set --app=$app --key=admin --value=$admin -email=$(ynh_user_get_info --username=$admin --key=mail) - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -104,8 +103,8 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=1 -ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" -ynh_replace_string --match_string="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service" +ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" +ynh_replace_string --match_string="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service" ynh_add_systemd_config @@ -113,15 +112,17 @@ ynh_add_systemd_config # CONFIGURE CONFIG.JS #================================================= -# Copy default configuration file -mv "../conf/config.js" "$final_path/config/config.js" +# # Copy default configuration file +# mv "../conf/config.js" "$final_path/config/config.js" -ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config/config.js" -ynh_replace_string --match_string="__PORTI__" --replace_string="$porti" --target_file="$final_path/config/config.js" -ynh_replace_string --match_string="__ADMIN_MAIL__" --replace_string="$email" --target_file="$final_path/config/config.js" +# ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config/config.js" +# ynh_replace_string --match_string="__PORTI__" --replace_string="$porti" --target_file="$final_path/config/config.js" +# ynh_replace_string --match_string="__EMAIL__" --replace_string="$email" --target_file="$final_path/config/config.js" -# Store file checksum to detected user modifications on upgrade -ynh_store_file_checksum "$final_path/config/config.js" +# # Store file checksum to detected user modifications on upgrade +# ynh_store_file_checksum "$final_path/config/config.js" + +ynh_add_config --template="../conf/config.js" --destination="$final_path/config/config.js" #================================================= # INSTALL CRYPTPAD diff --git a/scripts/upgrade b/scripts/upgrade index 696cf22..c99ed92 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -111,17 +111,19 @@ ynh_system_user_create --username=$app # CONFIGURE CONFIG.JS #================================================= -ynh_backup_if_checksum_is_different "$final_path/config/config.js" +# ynh_backup_if_checksum_is_different "$final_path/config/config.js" -# Copy default configuration file -mv "../conf/config.js" "$final_path/config/config.js" +# # Copy default configuration file +# mv "../conf/config.js" "$final_path/config/config.js" -ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config/config.js" -ynh_replace_string --match_string="__PORTI__" --replace_string="$porti" --target_file="$final_path/config/config.js" -ynh_replace_string --match_string="__ADMIN_MAIL__" --replace_string="$email" --target_file="$final_path/config/config.js" +# ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config/config.js" +# ynh_replace_string --match_string="__PORTI__" --replace_string="$porti" --target_file="$final_path/config/config.js" +# ynh_replace_string --match_string="__EMAIL__" --replace_string="$email" --target_file="$final_path/config/config.js" -# Store file checksum to detected user modifications on upgrade -ynh_store_file_checksum "$final_path/config/config.js" +# # Store file checksum to detected user modifications on upgrade +# ynh_store_file_checksum "$final_path/config/config.js" + +ynh_add_config --template="../conf/config.js" --destination="$final_path/config/config.js" #================================================= # INSTALL CRYPTPAD