Connect to postgres regional read replicas from docker image instances outside PRIMARY_REGION?

I understand it’s necessary to use port 5433 instead of port 5432 to connect to the nearest postgres read replica, and the conditional logic for an app is explained here

I’m wondering if there are any recommended approaches for achieving this with Docker image deployments? For instance, I’ve got hasura deployed in multiple regions and right now they all point to the primary postgres region via an ENV var.

I figured one approach might be to make a local Dockerfile that extends the image, providing a conditional ENV var to use port 5433 if PRIMARY_REGION != CURRENT_REGION?