Modifying run/debug configurations environment variables list
Hello,
I would like to modify run/debug configurations environment variables list (add some entries).
What i realized based on the project type run/debug configuration object changes (For SpringBootApplication -> com.intellij.spring.boot.run.SpringBootApplicationRunConfiguration ) which i guess is not part of the community edition.
Is there an easy way to set the environment variables list for all configurations that support environment variables or this should be handled configuration by configuration ? Right now i am using reflection on the RunConfiguration object this works for SpringBoot application and Application configuration types.
// if configuration type does not have getEnvs method this call will fail
Method method = target.getClass().getMethod("getEnvs");
Map<String, String> envVars = (Map<String, String>) method.invoke(runConfig);
awsTokens.entrySet().stream().forEach((entry) -> {
envVars.put(entry.getKey().name(), entry.getValue());
Please sign in to leave a comment.