KNOX-261: Better env checking and error messages in gateway.sh