Closed DanielWeigl closed 3 years ago
@ashald hi did you have any chance to review this change or any plans on merging it / releasing a new version?
@DanielWeigl hi there! Sorry for a super late reply. I have limited spare time these days and don't get to update this plugin often. First of all, thanks for your contribution!
I think the idea behind your change is really powerful and it opens doors to injecting arbitrary values sourced from the runtime environment or even through interpretation of unsupported formats.
I did a little research on such an approach and found that same effect can be achieved with current capabilities of the plugin and existing IDE functionality. It doesn't work exactly as the change you propose, but the result and capabilities are the same.
1) I added a run configuration to execute a shell script like this one:
echo "FOO=$(date)" > dev.env
2) Next, I opened a run configuration that I'm actually interested in and added the above one into "Run Before"
Now, whenever I run my Python script:
import os
print("Date is: "+os.environ.get("FOO"))
I get an up to date output.
I'm not sure when exactly "Shell Script" run configuration was added and if "Run Before" is available on all of existing run configurations. That being said, the less code there is the better so I'm rather inclined on not merging this PR to keep the plugin simpler. Please let mw know if I'm missing something.
Hi, no problem - i know how sparse time can be.
Yes your solution, running a script that generates the env-file also sounds okay'ish and has the same effect as my approach. Im okay with a none-merge in this case
which runs the provided script/executable and uses its output as .env file.
E.g to get the current branch name into an environment varible to use it for per-branch configurations in the development environment.