Created
March 30, 2012 21:07
-
-
Save InPermutation/2255010 to your computer and use it in GitHub Desktop.
Get a config for https://github.com/felixge/node-mysql from heroku DATABASE_URL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function mysqlConfigFromEnvironment (){ | |
| var dbUrl = process.env.DATABASE_URL; | |
| var parsed = url.parse(dbUrl); | |
| return { | |
| host: parsed.host, | |
| port: parsed.port || 3306, | |
| user: parsed.auth.split(':')[0], | |
| password: parsed.auth.split(":")[1] | |
| }; | |
| }; | |
| var client = mysql.createClient(mysqlConfigFromEnvironment()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment