From 966fe1ef7947b0eb631c0d98881b4a57225be21d Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 9 May 2022 16:56:28 +0200 Subject: [PATCH] Fix --- conf/.env | 4 ++-- scripts/_common.sh | 2 +- scripts/install | 22 +++++----------------- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/conf/.env b/conf/.env index ff67513..4fe0787 100644 --- a/conf/.env +++ b/conf/.env @@ -145,8 +145,8 @@ DAV_ENABLED=true # This is to make sure that only the mobile application that you approve can # access the route to let your users sign in with their credentials # Note: the official mobile application is not currently available on the stores. -MOBILE_CLIENT_ID=__MOBILE_ID__ -MOBILE_CLIENT_SECRET=__MOBILE_KEY__ +MOBILE_CLIENT_ID=MOBILE_ID +MOBILE_CLIENT_SECRET=MOBILE_KEY # Allow to access general statistics about your instance through a public API # call diff --git a/scripts/_common.sh b/scripts/_common.sh index f98b4d0..6c3e3c7 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -10,7 +10,7 @@ YNH_PHP_VERSION="7.4" YNH_COMPOSER_VERSION="2.3.3" -pkg_dependencies="php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-dom php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-iconv php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-mysqli php${YNH_PHP_VERSION}-opcache php${YNH_PHP_VERSION}-redis php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip" +pkg_dependencies="php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-dom php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-iconv php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-mysqli php${YNH_PHP_VERSION}-opcache php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip" #================================================= # PERSONAL HELPERS diff --git a/scripts/install b/scripts/install index 075c87b..cfbd343 100755 --- a/scripts/install +++ b/scripts/install @@ -130,16 +130,7 @@ chown -R $app:www-data "$final_path" #================================================= ynh_script_progression --message="Adding a configuration file..." -config="$final_path/.env" -cp ../conf/.env "$config" - -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config" -ynh_replace_string --match_string="__RANDOM_KEY__" --replace_string="$random_key" --target_file="$config" -ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_name" --target_file="$config" -ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config" -ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config" -ynh_replace_string --match_string="__EMAIL__" --replace_string="$email" --target_file="$config" -ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$config" +ynh_add_config --template="../conf/.env" --destination="$final_path/.env" #================================================= # DEPLOY @@ -156,19 +147,16 @@ pushd "$final_path" ynh_exec_warn_less ynh_exec_as $app php$phpversion artisan passport:client --password -n > key.txt 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- ) - ynh_replace_string --match_string="__MOBILE_ID__" --replace_string="$mobile_id" --target_file="$config" - ynh_replace_string --match_string="__MOBILE_KEY__" --replace_string="$mobile_key" --target_file="$config" + ynh_replace_string --match_string="MOBILE_ID" --replace_string="$mobile_id" --target_file="$final_path/.env" + ynh_replace_string --match_string="MOBILE_KEY" --replace_string="$mobile_key" --target_file="$final_path/.env" ynh_app_setting_set --app=$app --key=mobile_id --value=$mobile_id ynh_app_setting_set --app=$app --key=mobile_key --value=$mobile_key ynh_secure_remove --file="$final_path/key.txt" ynh_exec_warn_less ynh_exec_as $app php$phpversion artisan config:cache popd -# Calculate and store the config file checksum into the app settings -ynh_store_file_checksum --file="$config" - -chmod 400 "$config" -chown $app:$app "$config" +chmod 400 "$final_path/.env" +chown $app:$app "$final_path/.env" update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION}