Skip to content

Commit 882da94

Browse files
authored
Update wp-post.sh
1 parent 7ff4964 commit 882da94

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

wordpress/wp-post.sh

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ for var in \
6464
NPP_UID \
6565
NPP_GID \
6666
NPP_DEV_ENABLED \
67-
NPP_NGINX_IP \
6867
NPP_HTTP_HOST \
6968
NPP_DEV_PLUGIN_NAME \
7069
NPP_DEV_PLUGIN_DIR \
@@ -160,7 +159,6 @@ resolve_host() {
160159
# extra_hosts:
161160
# - "example.com:Nginx_LAN_IP"
162161
###############################################################################################################
163-
164162
if [[ "${NPP_DEV_ENABLED}" -eq 1 ]]; then
165163
# Create array
166164
mapfile -t ip_array < <(resolve_host host.docker.internal)
@@ -170,22 +168,15 @@ if [[ "${NPP_DEV_ENABLED}" -eq 1 ]]; then
170168
HOSTS="/etc/hosts"
171169

172170
# Hack /etc/hosts kindly, not make container upset
173-
# Map to host.docker.internal if available
171+
# Map to host.docker.internal
174172
if (( ${#ip_array[@]} )); then
175173
for IP in "${ip_array[@]}"; do
176174
echo "${IP} ${NPP_HTTP_HOST}" >> "${TEMP_HOSTS}"
177175
done
176+
178177
cat "${HOSTS}" >> "${TEMP_HOSTS}"
179178
cat "${TEMP_HOSTS}" > "${HOSTS}"
180179
echo -e "${COLOR_GREEN}${COLOR_BOLD}NPP-WP:${COLOR_RESET} ${COLOR_RED}Hacked!${COLOR_RESET} Mapped ${COLOR_LIGHT_CYAN}${NPP_HTTP_HOST}${COLOR_RESET} to host.docker.internal ${COLOR_LIGHT_CYAN}${ip_array[@]}${COLOR_RESET} in ${COLOR_LIGHT_CYAN}${HOSTS}${COLOR_RESET}."
181-
else
182-
# Fallback, Map to NGINX container IP
183-
IP="${NPP_NGINX_IP}"
184-
LINE="${IP} ${NPP_HTTP_HOST}"
185-
HOSTS="/etc/hosts"
186-
echo -e "${LINE}\n$(cat ${HOSTS})" > "${TEMP_HOSTS}"
187-
cat "${TEMP_HOSTS}" > "${HOSTS}"
188-
echo -e "${COLOR_GREEN}${COLOR_BOLD}NPP-WP:${COLOR_RESET} ${COLOR_RED}Hacked!${COLOR_RESET} Mapped ${COLOR_LIGHT_CYAN}${NPP_HTTP_HOST}${COLOR_RESET} to Nginx container IP ${COLOR_LIGHT_CYAN}${IP}${COLOR_RESET} in ${COLOR_LIGHT_CYAN}${HOSTS}${COLOR_RESET}."
189180
fi
190181
fi
191182
################################################################################################################

0 commit comments

Comments
 (0)