Closed tejoha closed 1 year ago
Thank you for the contribution! I will try my best to find time to review it as soon as possible.
Just a heads up: my laptop is been stuck in Apple repair chain and my OSS activity is suspended until it’s back. I appreciate the contribution and eager to get it merged!
I'm super sorry for a late reply - don't have much spare time to maintain the plugin so it took me a while to get back to this.
First of all, thank you again for spending your time on contributing to the plugin.
Could you please take a look at this comment https://github.com/ashald/EnvFile/pull/92#issuecomment-606350489 - do you think using same approach could address your use-case? As mentioned in by the link, I believe that the less code is better and while merging this PR would've provided some convenience, given that similar functionality can be achieved by executing external tools by an IDE in an automated way, I'd rather err on the side of not merging the PR.
Please let me know what do you think about it.
I tried it a little bit and found a Issue:
I created a small shell script like you, but added a sleep command
sleep 5
echo "Foo=$(Date)" > src/dev.env
Created a simple Java program
public class Foo {
public static empty main(String[] args) {
System.out.println(System.getenv("Foo"));
}
}
Addd the script to "Before Launch"
The problem is that the IDE just launches the script, but doesn't wait for it to finish. The Java program (and the EnvFile plugin) is executed before the script has finished. So the EnvFile plugin cannot read the current version file. I think this is also the reason for the PR https://github.com/ashald/EnvFile/pull/92
Great catch, thanks! I will keep looking into it.
It's been forever, but FWIW I now think that plugin should evolve to support more sources. I'm not sure about "single-value" though, and rather think about allowing plugin to run scripts so that you can could generate whatever env vars you want to output them via stdout. This way, you could make network calls, run system utils [to get the IP address], etc. With that in mind I'll be rejecting this PR, but keep an eye on the plugin updates for new functionality.
See pull request #77
Added a new "env provider type" to set a single environment variable by a selected option. Sample implementation: "IP".