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

@@ -62,7 +62,7 @@ require:
mkdir -p $(VOLUMES_D)
# verify if the wordpress url is added to the local path
@echo $(B_PURPLE)"verify if the wordpress url is added to the local path"$(RESET)
- if ! grep "127.0.0.1 $(WP_URL)" /etc/hosts 2> /dev/null; then \
- if ! grep "127.0.0.1 $(WP_URL)" /etc/hosts 2> /dev/null; then \
echo $(B_PURPLE)"nop ! adding it"$(RESET) \
bash -c 'echo -e "\n# adding for lejourduprof (you can delete it)\n127.0.0.1 $(WP_URL)" >> /etc/hosts'; \
fi
@@ -76,7 +76,7 @@ build_logs:
up:
docker compose -f $(COMPOSE_FILE) up -d
@echo $(B_PURPLE)"you can now connect at "$(B_YELLOW)"https://$(WP_URL)"$(B_PURPLE)" or 127.0.0.1"$(RESET)
@echo $(B_PURPLE)"you can now connect at "$(B_YELLOW)"https://$(WP_COMPLETE_URL)"$(B_PURPLE)" or 127.0.0.1"$(RESET)
down:
docker compose -f $(COMPOSE_FILE) down

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