My app is split between two repositories, one client and one API. My
render.yaml lives in my client repository.
When I create a Preview Environment I run into two challenges:
- How can I tell my preview environment to also use a separate branch for the API?
- How can I dynamically rewrite my routes to point to the preview API?
My render.yaml looks something like this:
previewsEnabled: true services: - type: web env: static repo: https://github.com/me/foobar.git routes: - type: rewrite source: /api/* destination: https://foobar-api.onrender.com/* - type: web env: node repo: https://github.com/me/foobar-api.git
I assume the right answer to (1) is to just use two render.yaml files, one for each repository.
As for the rewrites, I can of course manually change them in the
render.yaml but it would make it easy to accidentally push wrong routes to production. I think my setup is a common one so I’m guessing there must be a more elegant solution to this?