EnvFile icon indicating copy to clipboard operation
EnvFile copied to clipboard

Please enable variable substitution in variables (enableSubstitutionInVariables)

Open ilx opened this issue 6 years ago • 2 comments

To quote StringSubstitutor javadoc:

In some complex scenarios you might even want to perform substitution in the names of variables, for instance

${jre-${java.specification.version}}

StringSubstitutor supports this recursive substitution in variable names, but it has to be enabled explicitly by setting the enableSubstitutionInVariables property to true.

ilx avatar Mar 12 '19 12:03 ilx

I'm not sure I understand the use-case - can you please elaborate how this would bee useful or what you'd use it for? Thanks!

ashald avatar Jun 07 '19 15:06 ashald

I have a use-case.

In dev environment, I have to reference one UUID and in prod another. The env var name is common to many run configurations. (in my case TB_DEVICE)

What I would like is for in "Run Configuration" to have: Environment variables: SUB_DEVICE=FOO_DEVICE

Then in dev.env:

FOO_DEVICE =ad85fca0-a95f-11ed-a1c4-f5dd71066f12
BAR_DEVICE=981ce090-a95f-11ed-a1c4-f5dd71066f12

TB_DEVICE=${${SUB_DEVICE}}

That way I don't need different Run configuration entries for dev and prod (they can share one). Also, this allows me to define all device UUIDs in one place.

I am not sure what order environment variables are defined. Depending on order the substitution might need to be specified in the Run Configuration - Environment variables field.

skewty avatar Feb 10 '23 21:02 skewty