jglapa opened a new issue, #15391:
URL: https://github.com/apache/grails-core/issues/15391

   ### Expected Behavior
   
   This is a follow up from https://github.com/apache/grails-core/issues/15330 
that was incorrectly diagnosed.
   
   To supplement production overrides other than the ones in application.groovy 
an extra override file can be used and loaded from external file. 
   
   This is done in `Application.groovy` by using the `EnvironmentAware` 
interface: 
   ```groovy
   @Override
       void setEnvironment(Environment environment) {
           Resource resourceConfig = new 
FileSystemResource('prod-overrides.groovy')
           def parsedConfig = new ConfigSlurper().parse(resourceConfig.getURL())
           environment.propertySources.addFirst(new 
MapPropertySource("prod-overrides", parsedConfig))
       }
   ```
   
   snippet above will add additional config changes based on a file 
`prod-overrides.groovy`
   
   the file contains the following:
   ```
   grails {
       serverURL = 'https://grails7-absolute-link-issue.domain.com'
   }
   ```
   
   after starting the app by  `./gradlew :bootRun` and hitting 
`http://localhost:8080/makeLink/index` we should get:
   ```
   Link : https://grails7-absolute-link-issue.domain.com/makeLink/index/1
   serverURL: https://grails7-absolute-link-issue.domain.com
   ``` 
   
   this works fine with `grails6`
   
   
   ### Actual Behaviour
   
   when you run the same example on `grails7`, we get:
   ```
   Link : http://localhost:8080/makeLink/index/1
   serverURL: https://grails7-absolute-link-issue.domain.com
   ```
   
   ### Steps To Reproduce
   
   Run the example application (both versions) observe that grails7 manifest 
different behaviour. It seem the `LinkGenerator` initialisation happens earlier 
and ignores the extra overrides loaded with the additional config.
   
   Looks like  `asset.pipeline.grails.AssetPipelineAutoConfiguration` 
configures the `AssetSupportingCachingLinkGenerator` and does not account for 
the override.
   
   ### Environment Information
   
   _No response_
   
   ### Example Application
   
   https://github.com/jglapa/grails7-absolute-link-issue
   
   ### Version
   
   7.0.7


-- 
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