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
Project ID:
N/A
RAILWAY_SERVICE_{ServiceName}_URL
https://docs.railway.app/develop/variables#railway-provided-variablesHmm.
I can make a new environment variable that points to this one, right?
Like an alias?
Similar to the PG database variables.
nope
Ouch, that sucks.
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?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 providerif your frontend tooling supports loading variables from a
.env.production
file and also supports variable references you can do the aliasing in that fileHmm, that makes sense.
I'll do that, thanks!