Skip to content

Instantly share code, notes, and snippets.

@nemrosim
Created April 3, 2020 19:49
Show Gist options
  • Save nemrosim/e9642c6540bc30c06255a3e16132e7f6 to your computer and use it in GitHub Desktop.
Save nemrosim/e9642c6540bc30c06255a3e16132e7f6 to your computer and use it in GitHub Desktop.
adonis-database-config
'use strict';
/** @type {import('@adonisjs/framework/src/Env')} */
const Env = use('Env');
const Url = use('url-parse');
const CLEARDB_DATABASE_URL = new Url(Env.get('CLEARDB_DATABASE_URL'));
module.exports = {
connection: Env.get('DB_CONNECTION'),
mysql: {
client: 'mysql',
connection: {
host: Env.get('DB_HOST', CLEARDB_DATABASE_URL.host),
port: Env.get('DB_PORT', ''),
user: Env.get('DB_USER', CLEARDB_DATABASE_URL.username),
password: Env.get('DB_PASSWORD', CLEARDB_DATABASE_URL.password),
database: Env.get('DB_DATABASE', CLEARDB_DATABASE_URL.pathname.substr(1)),
},
debug: Env.get('DB_DEBUG', false),
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment