Fix web app credential data

This commit is contained in:
Edi Septriyanto
2021-12-11 23:13:50 +07:00
parent 8e18cc4aa8
commit 0575103c46

View File

@@ -1062,14 +1062,6 @@ function init_lemper_create() {
esac
done
# Default application credential data.
APP_UID="$(openssl rand -base64 32 | tr -dc 'a-z0-9' | fold -w 6 | head -n 1)"
APP_DB_USER="${USERNAME}_${APP_UID}"
APP_DB_PASS="$(openssl rand -base64 64 | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)"
APP_DB_NAME="app_${APP_UID}"
APP_ADMIN_USER="admin"
APP_ADMIN_PASS="$(openssl rand -base64 64 | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)"
if [[ "${MAIN_ARGS}" -ge 1 ]]; then
# Additional Check - ensure that Nginx's configuration meets the requirements.
if [[ ! -d /etc/nginx/sites-available && ! -d /etc/nginx/vhost ]]; then
@@ -1108,9 +1100,6 @@ function init_lemper_create() {
fail "User account '${USERNAME}' does not exist. Please add new account first! Aborting..."
fi
# Set application parameters.
[[ -z "${APP_ADMIN_EMAIL}" ]] && APP_ADMIN_EMAIL=${LEMPER_ADMIN_EMAIL:-"admin@${SERVERNAME}"}
# PHP Commands.
PHP_BIN=$(command -v "php${PHP_VERSION}")
PHP_COMPOSER_BIN=$(command -v composer)
@@ -1159,6 +1148,15 @@ function init_lemper_create() {
run chmod 755 "${WEBROOT}"
fi
# Set default application credential data.
APP_UID="$(openssl rand -base64 32 | tr -dc 'a-z0-9' | fold -w 6 | head -n 1)"
APP_DB_USER="${USERNAME}_${APP_UID}"
APP_DB_PASS="$(openssl rand -base64 64 | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)"
APP_DB_NAME="app_${APP_UID}"
APP_ADMIN_USER="admin"
APP_ADMIN_PASS="$(openssl rand -base64 64 | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)"
[[ -z "${APP_ADMIN_EMAIL}" ]] && APP_ADMIN_EMAIL=${LEMPER_ADMIN_EMAIL:-"admin@${SERVERNAME}"}
# Check framework parameter.
if [[ -z "${FRAMEWORK}" ]]; then
FRAMEWORK="default"