Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. set -e
  4.  
  5. # if `HOST_IP` is manually configured as env
  6. HOST="$HOST_IP"
  7.  
  8. # try to get the ip of the host from ns host.docker.internal
  9. if [[ -z "$HOST" ]]; then
  10. HOST=$(getent hosts host.docker.internal | awk '{ print $1 }')
  11. fi
  12.  
  13. # try to get the linux host ip
  14. if [[ -z "$HOST" ]]; then
  15. HOST=$(ip route | awk 'NR==1 {print $3}')
  16. fi
  17.  
  18. if ! test -z "$XDEBUG_CONF_FILE"
  19. then
  20. XDEBUG_CONF_FILE=/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
  21. fi
  22.  
  23. if [[ -f $XDEBUG_CONF_FILE ]]; then
  24. sed -i "s/xdebug\.remote_host=.*/xdebug\.remote_host=${HOST}/" $XDEBUG_CONF_FILE
  25. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement