Skip to content

Commit e5a5fee

Browse files
committed
LPD-67521 Update copyLiferayLXCRepositoryConfiguration to copy database properties
1 parent 4b64ff0 commit e5a5fee

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

buildSrc/src/main/groovy/docker-database-saas.gradle

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ ext {
5959
return
6060
}
6161

62+
File lcpJsonFile = new File(config.lxcRepositoryPath, "liferay/LCP.json")
63+
64+
if (!lcpJsonFile.exists()) {
65+
println "Unable to copy configurations from LXC repository, because ${config.lxcRepositoryPath} is not the liferay-lxc repository"
66+
67+
return
68+
}
69+
6270
File environmentFolder = null
6371

6472
if (config.lxcEnvironmentName == null) {
@@ -112,6 +120,27 @@ ext {
112120
return
113121
}
114122

123+
JsonSlurper jsonSlurper = new JsonSlurper()
124+
125+
Map<String, String> environmentVariables = jsonSlurper.parse(lcpJsonFile)["environments"][config.lxcEnvironmentName]
126+
127+
String jdbcURL = environmentVariables["LIFERAY_JDBC_PERIOD_DEFAULT_PERIOD_URL"]
128+
129+
if (jdbcURL != null && jdbcURL.startsWith("jdbc:postgresql://")) {
130+
config.useDatabasePostgreSQL = true
131+
132+
updateGradleLocalProperties([
133+
"lr.docker.environment.service.enabled[postgres]": "true"
134+
])
135+
}
136+
else {
137+
config.useDatabaseMySQL = true
138+
139+
updateGradleLocalProperties([
140+
"lr.docker.environment.service.enabled[mysql]": "true"
141+
])
142+
}
143+
115144
if (!config.databasePartitioningEnabled) {
116145
config.databasePartitioningEnabled = true
117146

0 commit comments

Comments
 (0)