1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/snipeit_ynh.git synced 2024-09-03 20:26:16 +02:00

Manage app_key

This commit is contained in:
yalh76 2022-07-02 19:23:33 +02:00
parent 271769aca5
commit e7e456fb25
3 changed files with 13 additions and 4 deletions

View file

@ -3,7 +3,7 @@
# -------------------------------------------- # --------------------------------------------
APP_ENV=production APP_ENV=production
APP_DEBUG=false APP_DEBUG=false
APP_KEY=__KEY__ APP_KEY=__APP_KEY__
APP_URL=http://__DOMAIN__ APP_URL=http://__DOMAIN__
APP_TIMEZONE='UTC' APP_TIMEZONE='UTC'
APP_LOCALE=__LANGUAGE__ APP_LOCALE=__LANGUAGE__

View file

@ -31,9 +31,6 @@ admin=$YNH_APP_ARG_ADMIN
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
email=$(ynh_user_get_info --username=$admin --key=mail)
key=$(ynh_string_random --length=24)
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
@ -127,6 +124,7 @@ ynh_script_progression --message="Adding a configuration file..."
redis_db=$(ynh_redis_get_free_db) redis_db=$(ynh_redis_get_free_db)
ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db"
app_key=""
ynh_add_config --template="../conf/.env" --destination="$final_path/.env" ynh_add_config --template="../conf/.env" --destination="$final_path/.env"
chmod 600 "$final_path/.env" chmod 600 "$final_path/.env"
@ -145,6 +143,10 @@ pushd "$final_path"
php$phpversion artisan config:cache -n php$phpversion artisan config:cache -n
popd popd
app_key="$(grep "^APP_KEY=" "$final_path/.env" | cut -d= -f2)"
ynh_app_setting_set --app=$app --key=app_key --value=$app_key
ynh_store_file_checksum --file="$final_path/.env"
# Set permissions to app files # Set permissions to app files
chown -R $app:www-data $final_path chown -R $app:www-data $final_path
chmod -R o-rwx $final_path chmod -R o-rwx $final_path

View file

@ -23,6 +23,7 @@ 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)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
app_key=$(ynh_app_setting_get --app=$app --key=app_key)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -71,6 +72,12 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi fi
# If app_key doesn't exist, create it
if [ -z "$app_key" ]; then
app_key="$(grep "^APP_KEY=" "$final_path/.env" | cut -d= -f2)"
ynh_app_setting_set --app=$app --key=app_key --value=$app_key
fi
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================