Inject env variables from docker-compose into Angular4 app

Viewed 2651

I build a simple Angular4 app which get its data from a REST-API.

I deploy the app with docker-compose but before I need to set the URL/Hostname to the API manually in my service module. During the dev I simply used 'localhost' and it does the job.

In the API I'am able inject the correct hostname via docker-compose (section environment) since it runs on the server but this is not possible for angular.

Are there any best practices / guides for injecting the hostname / URL into a angular-cli app from docker-compose?

2 Answers
Related