mirror of
https://github.com/YunoHost-Apps/mastodon_ynh.git
synced 2024-09-03 19:46:02 +02:00
use ynh_string_random
This commit is contained in:
parent
061b4f9b91
commit
b88b24c2d1
2 changed files with 6 additions and 6 deletions
|
@ -165,15 +165,15 @@ ynh_replace_string --match_string="__SMTP_FROM_ADDRESS__" --replace_string="$adm
|
|||
language="$(echo $language | head -c 2)"
|
||||
ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$config"
|
||||
|
||||
paperclip_secret=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128)
|
||||
paperclip_secret=$(ynh_string_random --length=128)
|
||||
ynh_replace_string --match_string="PAPERCLIP_SECRET=" --replace_string="PAPERCLIP_SECRET=$paperclip_secret" --target_file="$config"
|
||||
ynh_app_setting_set --app="$app" --key=paperclip_secret --value="$paperclip_secret"
|
||||
|
||||
secret_key_base=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128)
|
||||
secret_key_base=$(ynh_string_random --length=128)
|
||||
ynh_replace_string --match_string="__SECRET_KEY_BASE__" --replace_string="$secret_key_base" --target_file="$config"
|
||||
ynh_app_setting_set --app="$app" --key=secret_key_base --value="$secret_key_base"
|
||||
|
||||
otp_secret=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128)
|
||||
otp_secret=$(ynh_string_random --length=128)
|
||||
ynh_replace_string --match_string="__OTP_SECRET__" --replace_string="$otp_secret" --target_file="$config"
|
||||
ynh_app_setting_set --app="$app" --key=otp_secret --value="$otp_secret"
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ fi
|
|||
if [[ -z "$paperclip_secret" ]]; then
|
||||
paperclip_secret=$(grep -oP "PAPERCLIP_SECRET=\K\w+" $config)
|
||||
if [[ -z "$paperclip_secret" ]]; then
|
||||
paperclip_secret=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128)
|
||||
paperclip_secret=$(ynh_string_random --length=128)
|
||||
fi
|
||||
ynh_app_setting_set --app=$app --key=paperclip_secret --value="$paperclip_secret"
|
||||
fi
|
||||
|
@ -103,7 +103,7 @@ fi
|
|||
if [[ -z "$secret_key_base" ]]; then
|
||||
secret_key_base=$(grep -oP "SECRET_KEY_BASE=\K\w+" $config)
|
||||
if [[ -z "$secret_key_base" ]]; then
|
||||
secret_key_base=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128)
|
||||
secret_key_base=$(ynh_string_random --length=128)
|
||||
fi
|
||||
ynh_app_setting_set --app=$app --key=secret_key_base --value="$secret_key_base"
|
||||
fi
|
||||
|
@ -112,7 +112,7 @@ fi
|
|||
if [[ -z "$otp_secret" ]]; then
|
||||
otp_secret=$(grep -oP "OTP_SECRET=\K\w+" $config)
|
||||
if [[ -z "$otp_secret" ]]; then
|
||||
otp_secret=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128)
|
||||
otp_secret=$(ynh_string_random --length=128)
|
||||
fi
|
||||
ynh_app_setting_set --app=$app --key=otp_secret --value="$otp_secret"
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue