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