1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/baikal_ynh.git synced 2024-09-03 18:16:11 +02:00

deskey -> encrypt_key

This commit is contained in:
ericgaspar 2022-05-21 12:19:15 +02:00
parent c0eb4bca96
commit 29d25147e5
3 changed files with 11 additions and 10 deletions

View file

@ -20,7 +20,7 @@ system:
# Auth Backend LDAP-UserBind; attribute for email
dav_ldap_email_attr: 'mail'
database:
encryption_key: '__DESKEY__'
encryption_key: '__ENCRYPT_KEY__'
sqlite_file: "absolute/path/to/Specific/db/db.sqlite"
mysql: true
mysql_host: 'localhost'

View file

@ -23,7 +23,7 @@ domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
password=$YNH_APP_ARG_PASSWORD
timezone=$(cat /etc/timezone)
deskey=$(ynh_string_random 24)
encrypt_key=$(ynh_string_random 24)
password_hash=$(echo -n admin:BaikalDAV:$password | sha256sum | cut -d ' ' -f 1)
app=$YNH_APP_INSTANCE_NAME
@ -52,7 +52,7 @@ ynh_script_progression --message="Storing installation settings..." --weight=2
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=encrypt_key --value="$deskey"
ynh_app_setting_set --app=$app --key=encrypt_key --value="$encrypt_key"
ynh_app_setting_set --app=$app --key=password_hash --value="$password_hash"
#=================================================

View file

@ -24,7 +24,7 @@ db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
phpversion=$YNH_PHP_VERSION
password_hash=$(ynh_app_setting_get --app=$app --key=password_hash)
deskey=$(ynh_app_setting_get --app=$app --key=encrypt_key)
encrypt_key=$(ynh_app_setting_get --app=$app --key=encrypt_key)
#=================================================
# CHECK VERSION
@ -63,6 +63,13 @@ if [ -z "$db_name" ]; then
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
fi
# If password_hash doesn't exist, create it
if [ -z "$password_hash" ]; then
password=$(ynh_app_setting_get --app=$app --key=password)
password_hash=$(echo -n admin:BaikalDAV:$password | md5sum | cut -d ' ' -f 1)
ynh_app_setting_set --app=$app --key=password_hash --value=$password_hash
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
@ -139,12 +146,6 @@ then
#=================================================
ynh_script_progression --message="Upgrading the configuration file..." --weight=2
if [ -z "$password_hash" ]; then
password=$(ynh_app_setting_get --app=$app --key=password)
password_hash=$(echo -n admin:BaikalDAV:$password | md5sum | cut -d ' ' -f 1)
ynh_app_setting_set --app=$app --key=password_hash --value=$password_hash
fi
timezone=$(cat /etc/timezone)
path=${path_url%/}
ynh_add_config --template="../conf/baikal.yaml" --destination="$final_path/config/baikal.yaml"