0

can we detect hostname and apply condition into the env file

for example in the env file in NodeJs project

FRONTURL = location.window.hostname == 'staging.xyz.com' ? 'stage.com' : 'live.com';
simon
  • 359
  • 1
  • 14
  • You won't have access to the window object in Node.js environment. You just can't change the env on the run. Can you explain it a bit to what do you want to do and how are you doing it right now? – Apoorva Chikara Jul 26 '21 at 07:49
  • Actually we have FRONTENDURL and we would like to pass it dynamically e.g if hosting url says staging.domain.com then FRONTENDURL should says staging.domain.com and if hosting urls says domain.com then FRONTENDURL should says domain.com which is maintainly from env file – simon Jul 26 '21 at 07:59
  • Does this answer your question? [Node JS return hostname](https://stackoverflow.com/questions/20553554/node-js-return-hostname) – Titulum Jul 26 '21 at 08:18

0 Answers0