blockade icon indicating copy to clipboard operation
blockade copied to clipboard

Support environment variables in volume names

Open danielmai opened this issue 7 years ago • 2 comments

For the volumes configuration I want to use shell environment variables within the config string when specifying the directory paths to mount.

I want to be able to do this:

volumes:
  "$GOPATH/bin": "/gobin"

This should pick up the environment variable $GOPATH and use that for bind-mounting the directory to the container. That's how it works in a Docker Compose file.

Instead, in blockade, not only does it not recognize and expand the environment variable, it also creates a directory called $GOPATH and a subdirectory $GOPATH/bin in the current working directory.

danielmai avatar Nov 15 '18 21:11 danielmai

Ah, I just noticed that blockade does support environment variables.

https://github.com/worstcase/blockade/blob/master/blockade/config.py#L190

But it only accepts it with curly braces. ${GOPATH} works, but not $GOPATH. At least I can get it working now.

danielmai avatar Nov 15 '18 22:11 danielmai

Yeah that is a good point, the env variable parsing is quite basic. I think it was a quick hack thrown in, but that'd be a good thing to improve. I'll keep this open as a reminder.

labisso avatar Nov 17 '18 19:11 labisso