feat(cli): add shadow database host configuration
- Add ShadowHost config option to control shadow database connection
- Default to Hostname if ShadowHost not set
The scenario is the following:
- local supabase deployment, self hosted.
- running migrations inside our own container which has supa running via docker compose.
- attempt supabase
db diff --db-url...
This does not work since the docker running the shadow database is created on host, and 127.0.0.1 for host network is not accessible from inside our container.
In my case, i set the following in the config.toml >> shadow_host = "172.18.0.1" and now db diff works.
(open to alternative solutions!)
Pull Request Test Coverage Report for Build 12411481695
Details
- 7 of 7 (100.0%) changed or added relevant lines in 2 files are covered.
- 5 unchanged lines in 1 file lost coverage.
- Overall coverage decreased (-0.008%) to 59.736%
| Files with Coverage Reduction | New Missed Lines | % |
|---|---|---|
| internal/gen/keys/keys.go | 5 | 12.9% |
| <!-- | Total: | 5 |
| Totals | |
|---|---|
| Change from base Build 12406922166: | -0.008% |
| Covered Lines: | 7657 |
| Relevant Lines: | 12818 |
💛 - Coveralls
This does not work since the docker running the shadow database is created on host, and 127.0.0.1 for host network is not accessible from inside our container.
The shadow db container is always created using docker host network mode, so 127.0.0.1 should resolve to your host network from inside the container. I suspect the root cause is something else.
Could you try the following and let me know if there's any error?
DOCKER_HOST=172.18.0.1 supabase db diff --db-url ...