EnvFile icon indicating copy to clipboard operation
EnvFile copied to clipboard

Configuration Variables are not substituting .env file

Open ktalebian opened this issue 6 years ago • 2 comments

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?

ktalebian avatar Dec 07 '19 20:12 ktalebian

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

ashald avatar Mar 30 '20 23:03 ashald

@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:

  • Create a python file which prints an environment variable, e.g.
import os

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.

paulmdavies avatar Jun 02 '20 06:06 paulmdavies