dcapwell commented on code in PR #4231:
URL: https://github.com/apache/cassandra/pull/4231#discussion_r2255463056


##########
src/java/org/apache/cassandra/config/YamlConfigurationLoader.java:
##########
@@ -163,21 +169,63 @@ private static void maybeAddSystemProperties(Object obj)
         if 
(CassandraRelevantProperties.CONFIG_ALLOW_SYSTEM_PROPERTIES.getBoolean())
         {
             java.util.Properties props = System.getProperties();
-            Map<String, String> map = new HashMap<>();
-            for (String name : props.stringPropertyNames())
+            Map<String, Object> map = new HashMap<>();
+            for (String originalKey : props.stringPropertyNames())
             {
-                if (name.startsWith(SYSTEM_PROPERTY_PREFIX))
+                if (originalKey.startsWith(SYSTEM_PROPERTY_PREFIX))
                 {
-                    String value = props.getProperty(name);
-                    if (value != null)
-                        map.put(name.replace(SYSTEM_PROPERTY_PREFIX, ""), 
value);
+                    String value = props.getProperty(originalKey);
+                    String configKey = 
originalKey.replace(SYSTEM_PROPERTY_PREFIX, "");
+                    if (value != null && !map.containsKey(configKey)) {
+                        if (!DatabaseDescriptor.hasLoggedConfig()) // 
CASSANDRA-9909: Avoid flooding config during initialization
+                            logger.warn("Detected JVM property {}={} override 
for cassandra configuration '{}' (ignored if setting does not exist).", 
originalKey, value, configKey);
+                        map.put(configKey, getScalarValueOrJsonObject(value));
+                    }
                 }
             }
             if (!map.isEmpty())
                 updateFromMap(map, false, obj);
         }
     }
 
+    private static void maybeAddEnvironmentVariables(Object obj)
+    {
+        if 
(CassandraRelevantProperties.CONFIG_ALLOW_ENVIRONMENT_VARIABLES.getBoolean())

Review Comment:
   this feels weird to me.  If you are setting a system property to allow this 
feature why would you then use envs?  Should this also check for a env to 
enable?
   
   ```export CAS_CONFIG_ENV_ENABLED=true```?



-- 
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: pr-unsubscr...@cassandra.apache.org

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


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

Reply via email to