t0mpere commented on code in PR #14235:
URL: https://github.com/apache/pinot/pull/14235#discussion_r1803035221


##########
pinot-spi/src/main/java/org/apache/pinot/spi/env/PinotConfiguration.java:
##########
@@ -170,8 +173,15 @@ public static List<Configuration> 
applyDynamicEnvConfig(List<Configuration> conf
       Map<String, String> environmentVariables) {
     return configurations.stream().peek(configuration -> {
       for (String dynamicEnvConfigVarName : 
configuration.getStringArray(ENV_DYNAMIC_CONFIG_KEY)) {
-        configuration.setProperty(dynamicEnvConfigVarName,
-            
environmentVariables.get(configuration.getString(dynamicEnvConfigVarName)));
+        //if the environment variable doesn't exist or the property is already 
checked do not add the property
+        //TODO: The configuration in controller, server iterating to check and 
add env variables twice. Need to solve
+        // this better.
+        Object envVar = 
environmentVariables.get(configuration.getString(dynamicEnvConfigVarName));
+        if (envVar != null) {

Review Comment:
   I mean something like:
   ```suggestion
           configuration.setProperty(TEMPLATED_KEY, true);
   ```
   This could be red in the next executions from `configuration` to check if 
the templating has happened already.
   Leaving this like this exposes you to issues like loading twice from random 
keys in the env. For example:
   Run 1:
   ```
   property=ENV_VAR_NAME -> Lookup(ENV_VAR_NAME)=path
   ```
   Run 2:
   ```
   property=path -> Lookup(path)=path_value
   ```
   
   This is unwanted and risky behavior in my opinion.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to