trying to achieve this ``` var ip = System.getenv(...
# gradle
x
trying to achieve this
Copy code
var ip = System.getenv("POSTGRES_PORT_5432_TCP_ADDR")
var port = System.getenv("POSTGRES_PORT_5432_TCP_PORT")

task("test").onlyIf( { 
   ip? && port? && DriverManager.getConnection("jdbc:postgresql://$ip:$port/postgres").isValid(10) 
})
e
Your source has syntax errors. Here’s one way to do it:
Copy code
task("test").onlyIf {
if (ip != null && port != null)
DriverManager.getConnection("jdbc:postgresql://$ip:$port/postgres").use {
it.isValid(10)
}
else false
}