Skip to content

Question: Why doesn't direnv support this substitution? #199

@msabramo

Description

@msabramo

I have this:

❯ cat .envrc
export DOCKER_HOST_IP="${${DOCKER_HOST#tcp://}%:[0-9]*}"

direnv doesn't like this.

❯ cd smdevstack
direnv: loading .envrc
./.envrc: line 2: ${${DOCKER_HOST#tcp://}%:[0-9]*}: bad substitution

❯ echo $DOCKER_HOST_IP


but it works when I manually source the file from my shell (zsh):

❯ source .envrc

❯ echo $DOCKER_HOST_IP
192.168.99.101

Why is that? I guess direnv is limited in the fanciness of what you can use in a .envrc?

If you're curious about the context of why I am trying to do such things in an .envrc, see docker/compose#2915 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions