1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pytition_ynh.git synced 2024-09-03 20:16:08 +02:00

Handle change_url

This commit is contained in:
Salamandar 2022-04-11 17:16:03 +02:00 committed by Félix Piédallu
parent 8a10013f5a
commit fd5207095e
4 changed files with 21 additions and 13 deletions

View file

@ -21,7 +21,7 @@
;upgrade=1 from_commit=CommitHash
;backup_restore=1
multi_instance=1
;change_url=1
change_url=1
;;; Options
Email=
Notification=none

View file

@ -23,3 +23,13 @@ pkg_dependencies=(
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================
generate_secret_key() {
(
set +o nounset
source "${final_path}/venv/bin/activate"
set -o nounset
python3 -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"
)
}

View file

@ -26,13 +26,13 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
ynh_script_progression --message="Loading installation settings..." --time --weight=1
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# Add settings here as needed by your application
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#db_user=$db_name
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
secret_key=$(generate_secret_key)
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
@ -108,8 +108,12 @@ fi
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# ...
# Reedit configuration files
#=================================================
ynh_script_progression --message="Updating app's configuration..." --time --weight=1
ynh_add_config --template="../conf/config.py" --destination="$final_path/pytition/pytition/pytition/settings/config.py"
ynh_add_config --template="../conf/uwsgi.yaml" --destination="/etc/uwsgi/apps-available/$app.yaml"
#=================================================
# GENERIC FINALISATION

View file

@ -153,13 +153,7 @@ chown -R $app:www-data "/var/log/$app"
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding configuration files..." --time --weight=1
secret_key=$(
set +o nounset
source "${final_path}/venv/bin/activate"
set -o nounset
python3 -c "from django.core.management.utils import get_random_secret_key as g; print(g())"
)
secret_key=$(generate_secret_key)
config_path="$final_path/pytition/pytition/pytition/settings/config.py"
ynh_add_config --template="../conf/config.py" --destination="$config_path"