From 419933f6505caf4c5e685f8436b1ff735185e55a Mon Sep 17 00:00:00 2001 From: Vijay Raghavan Aravamudhan Date: Sun, 1 Aug 2021 11:07:57 +0000 Subject: Moved 'internal-server' into a sub-folder as opposed to a git submodule. (#1715) * Ignored tests in 'internal-server' folder since there are none. * Linter fixes --- src/internal-server/config/database.js | 82 ++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 src/internal-server/config/database.js (limited to 'src/internal-server/config/database.js') diff --git a/src/internal-server/config/database.js b/src/internal-server/config/database.js new file mode 100644 index 000000000..1b5974359 --- /dev/null +++ b/src/internal-server/config/database.js @@ -0,0 +1,82 @@ +/** @type {import('@adonisjs/framework/src/Env')} */ +const Env = use('Env'); + +const dbPath = process.env.DB_PATH; + +module.exports = { + /* + |-------------------------------------------------------------------------- + | Default Connection + |-------------------------------------------------------------------------- + | + | Connection defines the default connection settings to be used while + | interacting with SQL databases. + | + */ + connection: Env.get('DB_CONNECTION', 'sqlite'), + + /* + |-------------------------------------------------------------------------- + | Sqlite + |-------------------------------------------------------------------------- + | + | Sqlite is a flat file database and can be a good choice for a development + | environment. + | + | npm i --save sqlite3 + | + */ + sqlite: { + client: 'sqlite3', + connection: { + // filename: Helpers.databasePath(`${Env.get('DB_DATABASE', 'development')}.sqlite`), + filename: dbPath, + }, + useNullAsDefault: true, + debug: Env.get('DB_DEBUG', false), + }, + + /* + |-------------------------------------------------------------------------- + | MySQL + |-------------------------------------------------------------------------- + | + | Here we define connection settings for MySQL database. + | + | npm i --save mysql + | + */ + mysql: { + client: 'mysql', + connection: { + host: Env.get('DB_HOST', 'localhost'), + port: Env.get('DB_PORT', ''), + user: Env.get('DB_USER', 'root'), + password: Env.get('DB_PASSWORD', ''), + database: Env.get('DB_DATABASE', 'adonis'), + }, + debug: Env.get('DB_DEBUG', false), + }, + + /* + |-------------------------------------------------------------------------- + | PostgreSQL + |-------------------------------------------------------------------------- + | + | Here we define connection settings for PostgreSQL database. + | + | npm i --save pg + | + */ + pg: { + client: 'pg', + connection: { + host: Env.get('DB_HOST', 'localhost'), + port: Env.get('DB_PORT', ''), + user: Env.get('DB_USER', 'root'), + password: Env.get('DB_PASSWORD', ''), + database: Env.get('DB_DATABASE', 'adonis'), + }, + debug: Env.get('DB_DEBUG', false), + }, +}; -- cgit v1.2.3-70-g09d2