I noticed that DATABASE_URL
environment variable resolves to the internal database url.
Is it possible to get access to the external database url within my web app? Possibly via a preset environment variable like DATABASE_URL
?
I noticed that DATABASE_URL
environment variable resolves to the internal database url.
Is it possible to get access to the external database url within my web app? Possibly via a preset environment variable like DATABASE_URL
?
Hi,
I assume you’re referring to a Blueprint? As environment variables aren’t generally automatically resolved/set.
If you’re accessing the Postgres instance from another service on Render you will want to use the internal database to avoid any latency in taking an unnecessary path out and back in through the Postgres proxy.
The connectionString
property only supports the internal/private connection string at this time.
Hi Alan!
Yes, I was referring to blueprints, and thanks for clarifying that " The connectionString
property only supports the internal/private connection string at this time"!
Is there an formula/pattern for how external db url are generated? In other words, is there anyway I can generate the external url using the internal connection string? For context: my goal is to pass the ‘external connection url’ to another (external) service that will query the same database. Since I can’t get access to the ‘external connection url’ directly, it would be great if i could programmatically generate the ‘external connection string’.
At first glance, it seems like I can simply append ${RENDER_DOMAIN_REGION}-postgres.render.com
to the host
. Will the approach consistently generate the correct ‘external connection string’?
Yes, the <database_id>.<database_region>-postgres.render.com
format would work to construct the external hostname.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.