added complete url variable in .env

This commit is contained in:
asus
2024-02-01 01:52:16 +01:00
parent cab7757043
commit 11270c5e69
4 changed files with 12 additions and 13 deletions

View File

@@ -12,6 +12,7 @@ PROJECT=jipf
WP_ADMIN=admin
WP_ADMIN_EMAIL=admin@email.fr
WP_ADMIN_PSWD='you shall not password !'
WP_COMPLETE_URL=local_lejourduprof.com:3003
WP_PORT=3003
WP_TITLE=title
WP_URL=local_lejourduprof.com

View File

@@ -17,6 +17,11 @@ DB_PSWD="you dont want to know"
WP_URL=local_lejourduprof.com
WP_PORT=3003
# concat url with port if not 443
WP_COMPLETE_URL="${WP_URL}"
if [ ! ${WP_PORT} -eq 443 ]; then
WP_COMPLETE_URL="${WP_URL}:${WP_PORT}"
fi
WP_VOLUME_DIR=/var/www/html
#WP_VOLUME_PLUGINS=/home/www-data
WP_TITLE=title

View File

@@ -29,13 +29,6 @@ else
fi
# concat url with port if not 443
echo -n "check port : "
COMPLETE_URL="${WP_URL}"
if [ ! ${WP_PORT} -eq 443 ]; then
COMPLETE_URL="${WP_URL}:${WP_PORT}"
fi
# install wp if not already installed
if ! wp core is-installed --path="${WP_VOLUME_DIR}" 2> /dev/null
then
@@ -73,12 +66,12 @@ else
#https://stackoverflow.com/questions/56344567/wordpress-prevent-redirection-to-main-url
echo -e ${YELLOW}checking config.php file with current url...${RESET}
HOME=$(php wp-cli.phar config get WP_HOME --path=${WP_VOLUME_DIR})
if [ ${HOME} != ${COMPLETE_URL} ] ; then
php wp-cli.phar config set WP_HOME ${COMPLETE_URL} --path=${WP_VOLUME_DIR}
if [ ${HOME} != ${WP_COMPLETE_URL} ] ; then
php wp-cli.phar config set WP_HOME ${WP_COMPLETE_URL} --path=${WP_VOLUME_DIR}
fi
SITEURL=$(php wp-cli.phar config get WP_SITEURL --path=${WP_VOLUME_DIR})
if [ ${SITEURL} != ${COMPLETE_URL} ] ; then
php wp-cli.phar config set WP_SITEURL ${COMPLETE_URL} --path=${WP_VOLUME_DIR}
if [ ${SITEURL} != ${WP_COMPLETE_URL} ] ; then
php wp-cli.phar config set WP_SITEURL ${WP_COMPLETE_URL} --path=${WP_VOLUME_DIR}
fi
fi