mirror of
https://github.com/YunoHost-Apps/lychee_ynh.git
synced 2024-09-03 19:36:36 +02:00
Handle APP_KEY environment parameter
This commit is contained in:
parent
8c1703ceaa
commit
3ff5f75391
3 changed files with 23 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
|||
APP_NAME=Lychee
|
||||
APP_ENV=production
|
||||
APP_KEY=
|
||||
APP_KEY=__APP_KEY__
|
||||
APP_DEBUG=false
|
||||
APP_URL=http://localhost
|
||||
|
||||
|
|
|
@ -128,9 +128,12 @@ ynh_install_composer --install_args="--ignore-platform-reqs"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Building..." --weight=10
|
||||
|
||||
app_key=$(ynh_string_random --length=32)
|
||||
ynh_app_setting_set --app=$app --key=app_key --value=$app_key
|
||||
|
||||
# Setup application config
|
||||
ynh_add_config --template="../conf/.env.example" --destination="$final_path/.env"
|
||||
|
||||
|
||||
# Setup application config
|
||||
pushd $final_path
|
||||
php$phpversion artisan key:generate -n --force --env
|
||||
|
|
|
@ -22,6 +22,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
app_key=$(ynh_app_setting_get --app=$app --key=app_key)
|
||||
phpversion=$YNH_PHP_VERSION
|
||||
|
||||
#=================================================
|
||||
|
@ -62,7 +63,7 @@ if [ -z "$final_path" ]; then
|
|||
fi
|
||||
|
||||
# If new datadir doesn't exist, create it
|
||||
if [ -z "/home/yunohost.app/$app" ]; then
|
||||
if [ -z "/home/yunohost.app/$app" ] || [ -z "$datadir" ]; then
|
||||
datadir=/home/yunohost.app/$app
|
||||
mkdir -p $datadir
|
||||
chmod 755 $datadir
|
||||
|
@ -71,6 +72,12 @@ if [ -z "/home/yunohost.app/$app" ]; then
|
|||
cp -a "$final_path/public/uploads" "$datadir/uploads"
|
||||
fi
|
||||
|
||||
# If app_key doesn't exist, create it
|
||||
if [ -z "$app_key" ]; then
|
||||
app_key=$(ynh_string_random --length=32)
|
||||
ynh_app_setting_set --app=$app --key=app_key --value=$app_key
|
||||
fi
|
||||
|
||||
# Cleaning legacy permissions
|
||||
if ynh_legacy_permissions_exists; then
|
||||
ynh_legacy_permissions_delete_all
|
||||
|
@ -103,6 +110,16 @@ chmod 750 "$final_path/bootstrap/cache"
|
|||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating the environment file..." --weight=1
|
||||
|
||||
ynh_add_config --template=".env.example" --destination="$final_path/.env"
|
||||
|
||||
chmod 660 "$final_path/.env"
|
||||
chown $app:www-data "$final_path/.env"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue