2

I'm developing a WebRTC app where the endpoints along with some other options are different for production and development. I was handed this project so one of codebases uses Nodejs and the other uses plain html, css and js. I know that Nodejs has some modules that provide environment specific configs (e.g. Config) but they are all server-side.

My current solution is to have a config.js file in both branches which is statically served to the client. This however doesn't feel like best practice, and managing them with Git is pretty sketchy since I want the config.js file to be included in the repository but I don't want to have them changed when merging branches.

What are the most common ways to pass environment specific configuration options to the client in a web app?

  • I create configuration files for each host name. The web app loads the configuration file associated with its own host name (if such a file exists). Configuration specific to that machine can go in that file. – Stephen Ostermiller Jul 20 '17 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.