1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/monica_ynh.git synced 2024-09-03 19:46:23 +02:00

Just save keys for precation but not in .env

This commit is contained in:
anmol 2020-10-15 21:08:36 +05:30
parent 438d534749
commit bb34677ad2
2 changed files with 2 additions and 18 deletions

View file

@ -153,11 +153,7 @@ pushd "$final_path"
mobile_id=$( cd $final_path && tail -2 key.txt | head -1 | cut -c 12- ) mobile_id=$( cd $final_path && tail -2 key.txt | head -1 | cut -c 12- )
mobile_key=$( cd $final_path && tail -1 key.txt | cut -c 16- ) mobile_key=$( cd $final_path && tail -1 key.txt | cut -c 16- )
private_key=$(sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g' storage/oauth-private.key) private_key=$(sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g' storage/oauth-private.key)
full_private_key="PASSPORT_PRIVATE_KEY="\"$private_key\"
public_key=$(sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g' storage/oauth-public.key) public_key=$(sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g' storage/oauth-public.key)
full_public_key="PASSPORT_PUBLIC_KEY="\"$public_key\"
echo "$full_private_key" >> .env
echo "$full_public_key" >> .env
ynh_replace_string --match_string="__IDENTITY__" --replace_string="$mobile_id" --target_file="$config" ynh_replace_string --match_string="__IDENTITY__" --replace_string="$mobile_id" --target_file="$config"
ynh_replace_string --match_string="__KEY__" --replace_string="$mobile_key" --target_file="$config" ynh_replace_string --match_string="__KEY__" --replace_string="$mobile_key" --target_file="$config"
ynh_app_setting_set --app=$app --key=mobile_id --value=$mobile_id ynh_app_setting_set --app=$app --key=mobile_id --value=$mobile_id

View file

@ -180,20 +180,12 @@ if [ -f $final_path/storage/oauth-private.key ]; then
mobile_key=$(ynh_app_setting_get --app=$app --key=mobile_key) mobile_key=$(ynh_app_setting_get --app=$app --key=mobile_key)
if [ -z $(ynh_app_setting_get --app=$app --key=private_key) ]; then if [ -z $(ynh_app_setting_get --app=$app --key=private_key) ]; then
private_key=$(sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g' $final_path/storage/oauth-private.key) private_key=$(sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g' $final_path/storage/oauth-private.key)
full_private_key="PASSPORT_PRIVATE_KEY="\"$private_key\"
public_key=$(sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g' $final_path/storage/oauth-public.key) public_key=$(sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g' $final_path/storage/oauth-public.key)
full_public_key="PASSPORT_PUBLIC_KEY="\"$public_key\" ynh_app_setting_set --app=$app --key=private_key --value=$private_key
else ynh_app_setting_set --app=$app --key=private_key --value=$public_key
private_key=$(ynh_app_setting_get --app=$app --key=private_key)
full_private_key="PASSPORT_PRIVATE_KEY="\"$private_key\"
public_key=$(ynh_app_setting_get --app=$app --key=public_key)
full_public_key="PASSPORT_PUBLIC_KEY="\"$public_key\"
fi fi
ynh_replace_string --match_string="__IDENTITY__" --replace_string="$mobile_id" --target_file="$config" ynh_replace_string --match_string="__IDENTITY__" --replace_string="$mobile_id" --target_file="$config"
ynh_replace_string --match_string="__KEY__" --replace_string="$mobile_key" --target_file="$config" ynh_replace_string --match_string="__KEY__" --replace_string="$mobile_key" --target_file="$config"
echo "$full_private_key" >> $final_path/.env
echo "$full_public_key" >> $final_path/.env
else else
pushd "$final_path" pushd "$final_path"
php$phpversion artisan down --retry="10" php$phpversion artisan down --retry="10"
@ -203,11 +195,7 @@ else
mobile_key=$( tail -1 key.txt | cut -c 16- ) mobile_key=$( tail -1 key.txt | cut -c 16- )
mobile_key=$( cd $final_path && tail -1 key.txt | cut -c 16- ) mobile_key=$( cd $final_path && tail -1 key.txt | cut -c 16- )
private_key=$(sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g' storage/oauth-private.key) private_key=$(sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g' storage/oauth-private.key)
full_private_key="PASSPORT_PRIVATE_KEY="\"$private_key\"
public_key=$(sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g' storage/oauth-public.key) public_key=$(sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g' storage/oauth-public.key)
full_public_key="PASSPORT_PUBLIC_KEY="\"$public_key\"
echo "$full_private_key" >> .env
echo "$full_public_key" >> .env
ynh_replace_string --match_string="__IDENTITY__" --replace_string="$mobile_id" --target_file="$config" ynh_replace_string --match_string="__IDENTITY__" --replace_string="$mobile_id" --target_file="$config"
ynh_replace_string --match_string="__KEY__" --replace_string="$mobile_key" --target_file="$config" ynh_replace_string --match_string="__KEY__" --replace_string="$mobile_key" --target_file="$config"
ynh_app_setting_set --app=$app --key=mobile_id --value=$mobile_id ynh_app_setting_set --app=$app --key=mobile_id --value=$mobile_id