ashald / EnvFile

EnvFile 3.x is a plugin for JetBrains IDEs that allows you to set environment variables for your run configurations from one or multiple files.
MIT License
539 stars 129 forks source link

Configuration Variables are not substituting .env file #99

Closed ktalebian closed 1 year ago

ktalebian commented 4 years ago

Here is a screenshot of the config:

image

And here is the environment variable from the Configuration tab:

image

My local.env file has SECRETS_DIR=/originalSecretDir When I run my application, I get:

Caused by: java.nio.file.NoSuchFileException: /originalSecretDir/rollbar-api.txt

Why is the configuration environment variable not replacing the env file?

ashald commented 4 years ago

I wasn't able to reproduce this. Have you figured out what was wrong?

paulmdavies commented 4 years ago

@ashald I'm experiencing this problem too, with IDEA 2020.1 and version 3.2.1 of your plugin.

For me, it was easy to reproduce on a toy project:

print(os.getenv('FOOVAR'))


- Run that to generate a run configuration - it will print 'None'
- In the run configuration, add an environment variable of `FOOVAR=foo` - running it now prints 'foo'
- In the run configuration again, enable envfile and add a file with `FOOVAR=bar` in it, making sure not to change any other settings, and that this file is below `<Run Configuration Env Vars>` in the list - running the script now prints 'bar', even though it should print 'foo'

Playing with the settings (e.g. turning on environment variable substitution, changing the priority order of environment variable sources) doesn't seem to have any effect - the only ways I've found to achieve the desired behaviour are to either delete the env file from the list, or disable the plugin.

I hope that help you to get to the bottom of this. Let me know if I can provide any more detail.