0

As

Holders.grailsApplication.mainContext.servletContext.getRealPath("/")

is not available anymore in application.groovy in recent Grails versions, I wonder how to get dynamic (webapp-name-dependent) datasources working again?

see

https://github.com/grails/grails-core/issues/10131

the same applies for Holders with the extend that in runtime.groovy, Holders.grailsApplication is not available so I cannot find a way to set properties with values related to the context path. Now I try to find a way to get our deployment scenario (same webapp deployed on same server, but each has another datasource)

user39950
  • 464
  • 3
  • 15
  • You mention calling `getRealPath` and you mention wanting web app name dependent data sources. Can you expand on what you are really trying to do? Are you trying to configure a data source name based on the context root? Are you wanting something like subdomain tenant resolvers? – Jeff Scott Brown Jan 31 '18 at 21:51
  • yes, I have the same app deployed in webapp1, then webapp2, etc. the same app, but they shall connect to different RDS instances. So the RDS instances we normally inject into System.properties via Tomcat's setenv.sh. but this is container-wide, so we need webapp-folder dependent nameing of the property key. The webapp folder name is the only difference between the apps. Maybe there is a way to put stuff in server.xml service entries, but yet I have not found it. Actually, the subdomain dependent tenant resolver idea describes the problem well. – user39950 Feb 02 '18 at 05:52

0 Answers0