1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/joomla_ynh.git synced 2024-09-03 19:26:34 +02:00

Adding secret

This commit is contained in:
yalh76 2022-03-22 23:38:41 +01:00
parent eb431ce802
commit 525553e750
3 changed files with 10 additions and 1 deletions

View file

@ -52,7 +52,7 @@ class JConfig
public $dbsslcipher = ''; public $dbsslcipher = '';
/* Server Settings */ /* Server Settings */
public $secret = ''; // Use something very secure. For example on linux the following command `cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-16} | head -n 1` public $secret = '__SECRET__'; // Use something very secure. For example on linux the following command `cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-16} | head -n 1`
public $gzip = false; public $gzip = false;
public $error_reporting = 'default'; public $error_reporting = 'default';
public $helpurl = 'https://help.joomla.org/proxy?keyref=Help{major}{minor}:{keyref}&lang={langcode}'; public $helpurl = 'https://help.joomla.org/proxy?keyref=Help{major}{minor}:{keyref}&lang={langcode}';

View file

@ -30,6 +30,7 @@ app=$YNH_APP_INSTANCE_NAME
admin_email=$(ynh_user_get_info --username="$admin" --key="mail") admin_email=$(ynh_user_get_info --username="$admin" --key="mail")
db_prefix="$(ynh_string_random --length="4")_" db_prefix="$(ynh_string_random --length="4")_"
secret=$(ynh_string_random --length="16")
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
@ -51,6 +52,7 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=db_prefix --value=$db_prefix ynh_app_setting_set --app=$app --key=db_prefix --value=$db_prefix
ynh_app_setting_set --app=$app --key=secret --value=$secret
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS

View file

@ -24,6 +24,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
db_prefix=$(ynh_app_setting_get --app=$app --key=db_prefix) db_prefix=$(ynh_app_setting_get --app=$app --key=db_prefix)
secret=$(ynh_app_setting_get --app=$app --key=secret)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -59,6 +60,12 @@ if [ -z "$db_prefix" ]; then
ynh_app_setting_set --app=$app --key=db_prefix --value=$db_prefix ynh_app_setting_set --app=$app --key=db_prefix --value=$db_prefix
fi fi
# If secret doesn't exist, create it
if [ -z "$secret" ]; then
secret=""
ynh_app_setting_set --app=$app --key=secret --value=$secret
fi
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================