Hi all, I created multiple services with its own u...
# sst
j
Hi all, I created multiple services with its own unique API endpoint for dev/prod. The problem is, I want service A to call service B, I literally do
fetch(nodeEnv === 'development' ? devUrl : prodUrl)
, if the service B url changes, service A fails. Is there a better way of doing this? I'm new to this, something like service discovery? I have no idea if that even helps Im just tossing buzzwords
s
Hi Jack. Can you pass the URL into the service as an environment variable?
j
Yea, I'm passing devUrl and prodUrl via environment variables. I dont have CICD setup yet. Ah okay, so this is the approach most people take?
s
Yup, I keep different environment files (e.g. .env.dev,.env.prod) that contain the environment variables I need for each environment