Giter Site home page Giter Site logo

Comments (5)

ashald avatar ashald commented on June 2, 2024

Can you share more details about EnvFile settings you use to reproduce the issue? Namely, is "Substitute env vars is enabled"?

from envfile.

ShrykeWindgrace avatar ShrykeWindgrace commented on June 2, 2024

I have the same issue. My settings are
image

$ cat vars.env
LOCAL_TEST_VARIABLE=$PROJECT_DIR$/something

With EnvFile-3.4.1 this variable get expanded to literally $PROJECT_DIR$/something. With EnvFile-3.2.2 it is correctly expanded to /full/path/to/project/something.

from envfile.

LeRoiLapin avatar LeRoiLapin commented on June 2, 2024

Sure.

The configuration I used is the same for each version (namely 3.2.2, 3.4.0 and 3.4.1) but I have yet to test if this issue is present for other version of intellij (I'm using the community edition, if I have enough time I will try to test with ultimate and another release).

As for the settings I have both Substitute Environment Variables and Process JetBrains path macro reference enable while รŒgnore missing filesandEnable experimental integrationsare disable. Working directory is set to the root directory of the project and in the previous example is/path/to/project(And of courseEnable EnvFile`).

Also while I'm using a gradle project the run configuration is done by intellij. I have confirmed by running some ut that the problem seems to come from the plugin (and further confirmation came from the downgrade to 3.2.2).

We encounter the problem on several different computer.

If you need anymore information feel free to ask, I will look on my side if I can find the issue and will submit a pull request if I can fix it.

Also I want to truly thank you for your works I never had any issue with it for the past 5 years

Edit:
Also I'm using Temurin 11

from envfile.

ShrykeWindgrace avatar ShrykeWindgrace commented on June 2, 2024

The problem boils down to the logic here:

private String renderValue(String template, @NotNull Map<String, String> context, PathMacroManager macroManager) {
val postMacro = envFileSettings.isPathMacroSupported()
? macroManager.expandPath(template)
: template;
if (!envFileSettings.isSubstituteEnvVarsEnabled()) {
return postMacro;
}
// resolve taking into account default values
String stage1 = new StringSubstitutor(context).replace(template);
// if ${FOO} was not resolved - replace it with empty string as it would've worked in bash
String stage2 = new StringSubstitutor(key -> context.getOrDefault(key, "")).replace(stage1);
return stage2;
}

If there is both Intellij macro substitution and regular env var substition, then the value stored in postMacro is discarded, and only env var substitution is done.

I do not have the expertise to say how the correct logic should look like, but the problem is definitely in that function. Maybe, the line 130 should read

String stage1 = new StringSubstitutor(context).replace(postMacro);

?

from envfile.

trduc79 avatar trduc79 commented on June 2, 2024

I had the same issue with version newer than 3.2.2 that $PROJECT_DIR$ is not recognized so cannot import packages from project folder.

from envfile.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.