I am not a render.com staff, just one of their users. So, with a configuration looking something like this:
previewsEnabled: true # this is important
- name: staging
- name: api
- key: DATABASE_URL
# ...and so on
api service will have
DATABASE_URL environment variable pointing to a
staging DB normally, but for a preview environment (for a pull request), it will point to a PR version of that database created specifically for that PR. It’s done automatically. There’s nothing more you have to do on your side.
So for example in my Elixir application, I just need something like this and that is it.
config :my_app, MyApp.Repo,
Hope this helps.