-
-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supports IntelliJ PathMacro like $PROJECT_DIR$ #70
Conversation
Why is this needed given that EnvFile supports relative paths? |
I need to set an environment variable containing absolute paths to some of my project files (for instance |
Ugh, my bad - I misunderstood the intent. Given that the plugin now supports environment variable interpolation I believe it'd be better to approach this feature in a different way. I'd rather keep the "core" functionality as limited as possible (like, set env vars from an ordered list of sources with an optional interpolation) and rather provide extra features with another level of extensions. For instance, right now plugin supports "yaml/json" and ".env" files as sources as well as "env vars defined in run configuration". All of those "sources" are implemented as extensions on their own. You can find interfaces and implementations in "core" module. So I'd rather suggest implementing this feature just as another "source". Does that make sense? |
No problem, maybe my description wasn't enough clear :) Do you mean I should create a new type of "source" with a new extension (different from .env/.yaml/.json) and don't change the behavior of all already existing sources (by updating If yes I'm not 100% sure it's a good idea. PathMacro variables like |
And by the way, the only two interesting lines in the Pull Request are:
They could be moved to EnvFileConfigurationEditor.collectEnv if you want to keep |
Yes, I was trying to keep And while we're discussing this, given that you mentioned that such macros are processed in run configuration env vars I believe you can set an env var |
So, I updated the pull request:
-->This workaround would work but is not really user-friendly. I think we can do better :) What do you think about the new modifications ? |
The PR looks good to me! I have 2 concerns though that I'd like to discuss with you.
|
So:
|
Thanks! With regards your 2nd point, I can imagine a situation like this: 1st file defines This would not work with current implementation but will be processed as expected if we will move macros expansion into the loop. I don't think we need to worry about optimizations here as it's relatively cheap operation and it's not like we're chasing milliseconds here. |
I don't get the point. You provided this example:
But with the current implementation we would have: After processing 1st file:
After processing 2nd file:
After processing 3rd file:
Then the path macro substitution would replace all the
|
Ugh, you're right, I missed that. Thanks! OK, last thing before merging the PR - would you mind adding yourself to |
Done |
Ahaha, a returning contributor. 🙂 That I did not envision. Thanks! |
You're welcome ! :) |
By the way, when do you think release and publish the last modifications ? |
Meh, we forgot to update changelog. :( |
Ok! Thank you! |
Supports IntelliJ PathMacro like$PROJECT_DIR$ in environment variable values. It allows the user to write
TEST=$PROJECT_DIR$/test.txt
in his env file instead ofTEST=/path/to/project/test.txt
PathMacroManager was found at https://intellij-support.jetbrains.com/hc/en-us/community/posts/206781805-Working-with-PROJECT-DIR-in-plugin-configuration-options