Getting endpoint URL when building preview environment?

Hi all,

I’m trying out Okteto for its preview environments and so far it has been awesome. Kudos to the team for building such an awesome product.

One hurdle I’m facing is having access to the endpoint URL while building the preview environment. I need this because our frontend app needs to know its own hostname, as well as the API’s hostname.

This URL will change from branch to branch, for example, in my latest branch, I have a URL that looks something like this:

https://growthbook-3000-bttf-growthbook-pr-1.cloud.okteto.net

I’m wondering how I can get ahold of this URL when building my preview environment so I can supply it in my docker-compose file as an environment variable.

Thanks in advance!

Welcome to the community @bttf :wave:t4:

During the preview environment deployment you can use the $OKTETO_NAMESPACE environment variable to get the variable part of the url. The service name and cloud.okteto.net are always static so you can hardcode them.

In your case, the url would be something like https://growthbook-3000-$OKTETO_NAMESPACE.cloud.okteto.net

Got it! Thanks so much