Direnv: .env variables are not expanded

Created on 8 Nov 2018  路  8Comments  路  Source: direnv/direnv

Good day,

Using dotenv from stdlib to load .env file does not seem to expand variables in the latter:

/tmp $ mkdir /tmp/tst; cd /tmp/tst
/tmp/tst $ echo 'FOO=${PWD}' > .env
/tmp/tst $ echo 'dotenv' > .envrc
direnv: error .envrc is blocked. Run `direnv allow` to approve its content.
/tmp/tst $ direnv allow
direnv: loading .envrc
direnv: export +FOO
/tmp/tst $ echo $FOO
${PWD}

I would actually expect FOO=/tmp/tst. At least this is what pipenv does :)

Direnv version 2.17.0

Thank you,
Zaar

Most helpful comment

soon ;)

All 8 comments

hi,

yes variable expansions are currently not supported: https://github.com/direnv/go-dotenv#missing

I don't have anything against them, it's just that I didn't have the personal need for them. Happy to get a PR!

I see
No worries, replaced with source_env .env :)

As for PR - looks like a nice thing to start with when I decide to learn Go one day. To clarify - the link you sent me is a direnv's own implementation of dotenv, right?

ok great :)

yes that's the package that direnv is using. It's quite self-contained so I decided to extract it out.

@haizaar this is fixed by #433

and merged. Thanks @hakamadare for implementing that feature!

Thank you! Looking forward to test in the next release.

hey @zimbatm - any thoughts about when you might put out the next minor release?

soon ;)

Was this page helpful?
0 / 5 - 0 ratings