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

Simplify conf

This commit is contained in:
ericgaspar 2021-03-17 12:02:40 +01:00
parent f37ee776fe
commit e5f2973a56
No known key found for this signature in database
GPG key ID: 574F281483054D44
5 changed files with 27 additions and 23 deletions

View file

@ -15,7 +15,6 @@
upgrade=1 from_commit=ddbb3b36b8bcd00e573456bd9ad07b1aa5e41cb1 upgrade=1 from_commit=ddbb3b36b8bcd00e573456bd9ad07b1aa5e41cb1
backup_restore=1 backup_restore=1
multi_instance=0 multi_instance=0
incorrect_path=0
port_already_use=1 port_already_use=1
change_url=1 change_url=1
;;; Options ;;; Options

View file

@ -142,7 +142,7 @@ module.exports = {
/* CryptPad will display a point of contact for your instance on its contact page /* CryptPad will display a point of contact for your instance on its contact page
* (/contact.html) if you provide it below. * (/contact.html) if you provide it below.
*/ */
adminEmail: '__ADMIN_MAIL__', adminEmail: '__EMAIL__',
/* /*
* By default, CryptPad contacts one of our servers once a day. * By default, CryptPad contacts one of our servers once a day.

View file

@ -1,8 +1,10 @@
location ^~ / { location ^~ / {
# Force usage of https
if ($scheme = http) { # Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent; rewrite ^ https://$server_name$request_uri? permanent;
} }
proxy_pass http://127.0.0.1:__PORT__; proxy_pass http://127.0.0.1:__PORT__;
proxy_redirect off; proxy_redirect off;
proxy_set_header Host $host; proxy_set_header Host $host;

View file

@ -27,6 +27,7 @@ domain=$YNH_APP_ARG_DOMAIN
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
path_url="/" path_url="/"
admin=$YNH_APP_ARG_ADMIN admin=$YNH_APP_ARG_ADMIN
email=$(ynh_user_get_info --username=$admin --key=mail)
app=$YNH_APP_INSTANCE_NAME 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=path_url --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=admin --value=$admin
email=$(ynh_user_get_info --username=$admin --key=mail)
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
@ -104,8 +103,8 @@ ynh_add_nginx_config
#================================================= #=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1 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="__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="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service"
ynh_add_systemd_config ynh_add_systemd_config
@ -113,15 +112,17 @@ ynh_add_systemd_config
# CONFIGURE CONFIG.JS # CONFIGURE CONFIG.JS
#================================================= #=================================================
# Copy default configuration file # # Copy default configuration file
mv "../conf/config.js" "$final_path/config/config.js" # 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="__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="__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="__EMAIL__" --replace_string="$email" --target_file="$final_path/config/config.js"
# Store file checksum to detected user modifications on upgrade # # Store file checksum to detected user modifications on upgrade
ynh_store_file_checksum "$final_path/config/config.js" # ynh_store_file_checksum "$final_path/config/config.js"
ynh_add_config --template="../conf/config.js" --destination="$final_path/config/config.js"
#================================================= #=================================================
# INSTALL CRYPTPAD # INSTALL CRYPTPAD

View file

@ -111,17 +111,19 @@ ynh_system_user_create --username=$app
# CONFIGURE CONFIG.JS # 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 # # Copy default configuration file
mv "../conf/config.js" "$final_path/config/config.js" # 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="__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="__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="__EMAIL__" --replace_string="$email" --target_file="$final_path/config/config.js"
# Store file checksum to detected user modifications on upgrade # # Store file checksum to detected user modifications on upgrade
ynh_store_file_checksum "$final_path/config/config.js" # ynh_store_file_checksum "$final_path/config/config.js"
ynh_add_config --template="../conf/config.js" --destination="$final_path/config/config.js"
#================================================= #=================================================
# INSTALL CRYPTPAD # INSTALL CRYPTPAD