quincycheng / cicd

This repo demonstrates how to use CyberArk Conjur to secure CI/CD pipeline

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simplify and generalize SERVER_IP detection

infamousjoeg opened this issue · comments

export server_ip=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'|grep -v 172*)

An easier and more effective way of doing this is:

hostname -I | awk '{print $1}'

I have ran into issues in certain VM environments and in AWS using the current method that was resolved globally by making this change.