Skip to content

Instantly share code, notes, and snippets.

@julioflima
Last active September 6, 2020 10:54
Show Gist options
  • Save julioflima/5372aba820e70265de2e64d8f59c2577 to your computer and use it in GitHub Desktop.
Save julioflima/5372aba820e70265de2e64d8f59c2577 to your computer and use it in GitHub Desktop.
Cloud in class, have all configuration of database.
const knex = require('knex');
module.exports = class Cloud {
constructor(enviroment) {
// Object
this.knex = knex;
// Variables
this.enviroment = enviroment;
}
connection() {
const development = this.development();
if ((this.enviroment = 'development')) return this.knex(development);
}
development() {
return {
client: 'sqlite3',
connection: {
filename: './model/database/db.sqlite',
},
migrations: {
directory: './model/database/migrations',
},
useNullAsDefault: true,
};
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment