Is it possible to get a service's deployment domain in another service in the same project?

Maybe through some env variable? Similar to how you get the PORT from the env.
9 Replies
Percy
Percy2y ago
Project ID: N/A
GetPsyched
GetPsychedOP2y ago
Hmm. I can make a new environment variable that points to this one, right? Like an alias? Similar to the PG database variables.
Brody
Brody2y ago
nope
GetPsyched
GetPsychedOP2y ago
Ouch, that sucks.
Brody
Brody2y ago
I'm gonna take a guess here and say that you want to prefix RAILWAY_SERVICE_{ServiceName}_URL with something so that you can use the variable in the frontend?
GetPsyched
GetPsychedOP2y ago
I don't want to prefix but rather alias In my project X, if I have a front-end A and back-end B, I'd just want to keep an env in the front-end called API_URL which aliases to RAILWAY_SERVICE_A_URL This helps keep my codebase agnostic from the actual hosting provider
Brody
Brody2y ago
if your frontend tooling supports loading variables from a .env.production file and also supports variable references you can do the aliasing in that file
GetPsyched
GetPsychedOP2y ago
Hmm, that makes sense. I'll do that, thanks!
Want results from more Discord servers?
Add your server