Created
April 3, 2020 19:49
-
-
Save nemrosim/e9642c6540bc30c06255a3e16132e7f6 to your computer and use it in GitHub Desktop.
adonis-database-config
This file contains 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
'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