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
545 stars 129 forks source link

Separate EnvFile Configuration between Run Configurations #175

Closed ansidev closed 1 year ago

ansidev commented 2 years ago

Expected:

Problem: The EnvFile configuration is a global config, so if I load app.env.dev in RC A, RC B will load app.env.dev the next time unless I update EnvFile config.

ashald commented 1 year ago

EnvFile is configured per run configuration.

ansidev commented 1 year ago

@ashald

EnvFile is configured per run configuration.

We expected this, but it doesn't work as expected. That's why I created this issue. However, I guess you didn't get it.

ashald commented 1 year ago

You did not mentioned the IDE so IDK how to reproduce it, but I just checked PyCharm and each run configuration had its own changes saved independently.

If you're still seeing the issue, you might want to try re-creating your project file.

ansidev commented 1 year ago

@ashald

Although this issue is from your plugin and I didn't use PyCharm, however, you said you tested this issue on PyCharm. So I made a record to reproduce this issue on PyCharm.

Steps to reproduce

  1. Install PyCharm.
  2. Install the plugin EnvFile and restart PyCharm.
  3. Create a simple Python program containing 3 files:

main.py:

import os

def print_env():
    print(os.environ['PY_ENV'])

if __name__ == '__main__':
    print_env()

app.env.dev:

PY_ENV=dev

app.env.test:

PY_ENV=test
  1. Create 2 run configurations as recorded in this video [dev] main and [test] main.

https://user-images.githubusercontent.com/6688235/203485140-1ce8dfb7-de62-4fa5-8207-a60b24b8d155.mov

As you can see in the above video:

Note [dev] main [test] main
Before updating app.env.dev (00:05) app.env.dev (00:06)
After updating app.env.test (00:20) app.env.test (00:16)

This means that the env file path is always the same for all run configurations.

Test Environment Information (if necessary)

Finally, I don't know how you reproduced this issue, but I doubt that after recording this video.