public
Created

Grails Configuration for MongoDB on AppFog (or Cloud Foundry)

  • Download Gist
DataSource.groovy
Groovy
1 2 3 4 5 6 7 8 9 10 11 12 13 14
// You'll need configuration like this to get MongoDB up and running with Grails on AppFog
// This config will also work locally
 
grails {
def vcap = System.env.VCAP_SERVICES
def credentials = vcap ? grails.converters.JSON.parse(vcap)["mongodb-1.8"][0]["credentials"] : null
mongo {
host = credentials ? credentials.hostname : "localhost"
port = credentials ? credentials.port : "27017"
username = credentials ? credentials.username : null
password = credentials ? credentials.password : null
databaseName = credentials ? credentials.db : "your-localhost-db-name"
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.