There's nothing wrong with resolving the domain name so that you get the ip address when you need it.
There's nothing wrong with resolving the domain name so that you get the ip address when you need it.