Skip to content
Discussion options

You must be logged in to vote

Good question. Hasura v2 does not have built-in support for conditional metadata based on the endpoint or environment, but there are a few battle-tested approaches:

1. Environment variables in metadata

You can use env vars in databases.yaml for the connection string itself, but unfortunately read_replicas as a block cannot be conditionally included/excluded via env vars.

2. Separate metadata directories (recommended)

The approach you mentioned is the way most teams handle this. Use hasura init to create two project directories (e.g. hasura-prod and hasura-dev), and share common table/relationship/permission definitions between them via symlinks or the !include tag. Then apply with hasura …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by miran248
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants