How to get hostname without port of grafana?

I know this isn’t 100% what you are looking for, but maybe this could help: