vscode-direnv icon indicating copy to clipboard operation
vscode-direnv copied to clipboard

Load .envrc from parent directories

Open DAddYE opened this issue 6 years ago • 4 comments

Hi,

Loading a .envrc from a parent directory is possible? Currently, the shell one is able to do so, but this plugin seems it's not.

direnv: loading ../../../../.envrc
direnv: export +JAVA_HOME ~GOPATH ~PATH

DAddYE avatar Nov 28 '18 19:11 DAddYE

As an example use case. I am working on Apache Arrow, whose Git repo has multiple projects (e.g. cpp, python) as sub-directories of the top-level directory. I set Arrow-wide environment variables in the .envrc of the top-level directory, but then I'm working on the C++ side, so I open arrow/cpp in VS Code. Then the plugin doesn't see the top-level arrow/.envrc, and doesn't set those environment variables.

chrish42 avatar May 05 '20 18:05 chrish42

@DAddYE i load the parent envrc through the local envrc. so the behavior is the same in any environment.

my default content of .envrc file:

#!/bin/bash

# load parent .envrc - https://github.com/direnv/direnv/blob/288c07b1fed27eb19c43e210c205cd6e806ffa07/man/direnv-stdlib.1.md#source_up-filename
# NOTE: the other .envrc is not checked by the security framework.
source_up .envrc

# ...

gullitmiranda avatar Jan 28 '21 23:01 gullitmiranda

Quite possible the issue has been fixed (was open in 2018), and yes, seems working properly now.

DAddYE avatar Jan 28 '21 23:01 DAddYE

This can be closed.

arulrajnet avatar Aug 14 '22 01:08 arulrajnet