tilt icon indicating copy to clipboard operation
tilt copied to clipboard

Tilt should load COMPOSE_PROJECT_NAME from the .env file

Open LeeShan87 opened this issue 2 years ago • 2 comments

Expected Behavior

docker-compose project name should be loaded from the .env file, if it is present.

Current Behavior

if docker_compose project_name is not specified, than the current directory name is used. docker_compose.go

Context

About Your Use Case

I try to introduce tilt to our developers and we heavily relying on COMPOSE_PROJECT_NAME defined in the dotenv file.

Workaround

As a workaround I added the following lines to my Tiltfile

load('ext://dotenv', 'dotenv')
dotenv()
docker_compose('docker-compose.yml',project_name=os.environ['COMPOSE_PROJECT_NAME'])

LeeShan87 avatar Feb 03 '23 16:02 LeeShan87

thanks for the report! i talked to the compose team about this. the problem is that there's a bunch of subtle order of operations / circular dependency problems in how the dotenv file interacts with the compose file, and how the compose file interacts with tilt. your workaround is a good one.

nicks avatar Feb 14 '23 19:02 nicks

Thank you, Nick, for your reply. I understand this can be a challenging task. I hope others will find my workaround useful in the meantime. You've done an awesome job with this project. I really love it. ^^

LeeShan87 avatar Feb 14 '23 20:02 LeeShan87