Skip to content

Instantly share code, notes, and snippets.

@djensen47
Created November 12, 2012 22:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djensen47/4062384 to your computer and use it in GitHub Desktop.
Save djensen47/4062384 to your computer and use it in GitHub Desktop.
Grails Configuration for MongoDB on AppFog (or Cloud Foundry)
// 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"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment