jamesfredley commented on code in PR #16552:
URL: https://github.com/apache/grails-core/pull/16552#discussion_r4220949473


##########
grails-core/src/main/groovy/grails/config/external/ExternalConfigRunListener.groovy:
##########
@@ -92,10 +94,11 @@ class ExternalConfigRunListener implements 
SpringApplicationRunListener {
 
     // Resolve final locations, taking into account user home prefix and file 
wildcards
     private List<Object> getLocations(ConfigurableEnvironment environment) {
-        List<Object> locations = 
environment.getProperty('grails.config.locations', List, []) as List<Object>
+        Binder binder = Binder.get(environment)
+        List<Object> locations = binder.bind('grails.config.locations', 
Bindable.listOf(Object)).orElse([])
         // See if grails.config.locations is defined in an environments block 
like 'development' or 'test'
         String environmentString = 
"environments.${Environment.current.name}.grails.config.locations"
-        locations = environment.getProperty(environmentString, List, locations)
+        locations = binder.bind(environmentString, 
Bindable.listOf(Object)).orElse(locations)

Review Comment:
   Custom environment names are adapted before they are bound, including 
uppercase, camel-case, and underscore forms.



##########
grails-core/src/test/groovy/org/grails/config/YamlPropertySourceLoaderSpec.groovy:
##########
@@ -157,6 +164,53 @@ class YamlPropertySourceLoaderSpec extends Specification {
         config.getProperty('app.names', List) == ['p', 'q']
     }
 
+    def "resolves placeholders in YAML scalar lists bound to configuration 
properties with environment #variables"() {
+        given:
+        def source = load('''\
+            app:
+              allowedOrigins:
+                - https://static.example.com
+                - "${EXAMPLE_ALLOWED_ORIGIN:https://default.example.com}";
+              ports: [8080, "${EXAMPLE_PORT:9090}"]
+              flags: [true, "${EXAMPLE_FLAG:false}"]
+              groups: [["${EXAMPLE_GROUP:primary}"], [secondary]]

Review Comment:
   Nested list indexes are rebuilt from the Spring-style keys, and the test 
covers forms such as app.groups[0][1].



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to