'How can I set a .`conf` to reference variables from a global `.env`

I have a .conf file that I want to reference a port number by an env var stored in a global .env file.

Rough file structure looks something like:

|-.env
|
|-scripts/conf/my_conf.conf

I'd like to be able to set my variables like such:

My .env

HOST_PORT=7070

My .conf

webServicePort=${HOST_PORT}

However, in my docker-compose.yml I have a healthcheck test which never passes. Indicating that this port reference is not working. How can I set a .conf to reference a global .env



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source