1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/glitchsoc_ynh.git synced 2024-09-03 19:15:59 +02:00

Fix multiple instance using the same redis namespace

This commit is contained in:
Tagada 2021-05-16 18:48:03 +02:00
parent 80f8313b40
commit cdc0af47cc
3 changed files with 11 additions and 0 deletions

View file

@ -39,6 +39,7 @@ LOCAL_DOMAIN=__DOMAIN__
# ----- # -----
REDIS_HOST=localhost REDIS_HOST=localhost
REDIS_PORT=6379 REDIS_PORT=6379
REDIS_NAMESPACE=__REDIS_NAMESPACE__
# PostgreSQL # PostgreSQL

View file

@ -162,6 +162,9 @@ config="$final_path/live/.env.production"
language="$(echo $language | head -c 2)" language="$(echo $language | head -c 2)"
redis_namespace=${app}_production
ynh_app_setting_set --app="$app" --key=redis_namespace --value="$redis_namespace"
secret_key_base=$(ynh_string_random --length=128) secret_key_base=$(ynh_string_random --length=128)
ynh_app_setting_set --app="$app" --key=secret_key_base --value="$secret_key_base" ynh_app_setting_set --app="$app" --key=secret_key_base --value="$secret_key_base"

View file

@ -23,6 +23,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin) admin=$(ynh_app_setting_get --app=$app --key=admin)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
language=$(ynh_app_setting_get --app=$app --key=language) language=$(ynh_app_setting_get --app=$app --key=language)
redis_namespace=$(ynh_app_setting_get --app=$app --key=db_name)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$(ynh_sanitize_dbid --db_name=$app) db_user=$(ynh_sanitize_dbid --db_name=$app)
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
@ -85,6 +86,12 @@ fi
# Remove paperclip_secret # Remove paperclip_secret
ynh_app_setting_delete --app=$app --key=paperclip_secret ynh_app_setting_delete --app=$app --key=paperclip_secret
# If redis_namespace doesn't exist, create it
if [[ -z "$redis_namespace" ]]; then
redis_namespace=${app}_production
ynh_app_setting_set --app=$app --key=redis_namespace --value=$redis_namespace
fi
# If secret_key_base doesn't exist, retrieve it or create it # If secret_key_base doesn't exist, retrieve it or create it
if [[ -z "$secret_key_base" ]]; then if [[ -z "$secret_key_base" ]]; then
secret_key_base=$(grep -oP "SECRET_KEY_BASE=\K\w+" $config) secret_key_base=$(grep -oP "SECRET_KEY_BASE=\K\w+" $config)