diff options
author | Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com> | 2021-08-01 11:07:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-01 16:37:57 +0530 |
commit | 419933f6505caf4c5e685f8436b1ff735185e55a (patch) | |
tree | 152dcb9d2b35d29f862cc57a605b9ae2a0f7c300 /src/internal-server/config/database.js | |
parent | Removed duplicated contributors badge. (diff) | |
download | ferdium-app-419933f6505caf4c5e685f8436b1ff735185e55a.tar.gz ferdium-app-419933f6505caf4c5e685f8436b1ff735185e55a.tar.zst ferdium-app-419933f6505caf4c5e685f8436b1ff735185e55a.zip |
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
Diffstat (limited to 'src/internal-server/config/database.js')
-rw-r--r-- | src/internal-server/config/database.js | 82 |
1 files changed, 82 insertions, 0 deletions
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 @@ | |||
1 | /** @type {import('@adonisjs/framework/src/Env')} */ | ||
2 | const Env = use('Env'); | ||
3 | |||
4 | const dbPath = process.env.DB_PATH; | ||
5 | |||
6 | module.exports = { | ||
7 | /* | ||
8 | |-------------------------------------------------------------------------- | ||
9 | | Default Connection | ||
10 | |-------------------------------------------------------------------------- | ||
11 | | | ||
12 | | Connection defines the default connection settings to be used while | ||
13 | | interacting with SQL databases. | ||
14 | | | ||
15 | */ | ||
16 | connection: Env.get('DB_CONNECTION', 'sqlite'), | ||
17 | |||
18 | /* | ||
19 | |-------------------------------------------------------------------------- | ||
20 | | Sqlite | ||
21 | |-------------------------------------------------------------------------- | ||
22 | | | ||
23 | | Sqlite is a flat file database and can be a good choice for a development | ||
24 | | environment. | ||
25 | | | ||
26 | | npm i --save sqlite3 | ||
27 | | | ||
28 | */ | ||
29 | sqlite: { | ||
30 | client: 'sqlite3', | ||
31 | connection: { | ||
32 | // filename: Helpers.databasePath(`${Env.get('DB_DATABASE', 'development')}.sqlite`), | ||
33 | filename: dbPath, | ||
34 | }, | ||
35 | useNullAsDefault: true, | ||
36 | debug: Env.get('DB_DEBUG', false), | ||
37 | }, | ||
38 | |||
39 | /* | ||
40 | |-------------------------------------------------------------------------- | ||
41 | | MySQL | ||
42 | |-------------------------------------------------------------------------- | ||
43 | | | ||
44 | | Here we define connection settings for MySQL database. | ||
45 | | | ||
46 | | npm i --save mysql | ||
47 | | | ||
48 | */ | ||
49 | mysql: { | ||
50 | client: 'mysql', | ||
51 | connection: { | ||
52 | host: Env.get('DB_HOST', 'localhost'), | ||
53 | port: Env.get('DB_PORT', ''), | ||
54 | user: Env.get('DB_USER', 'root'), | ||
55 | password: Env.get('DB_PASSWORD', ''), | ||
56 | database: Env.get('DB_DATABASE', 'adonis'), | ||
57 | }, | ||
58 | debug: Env.get('DB_DEBUG', false), | ||
59 | }, | ||
60 | |||
61 | /* | ||
62 | |-------------------------------------------------------------------------- | ||
63 | | PostgreSQL | ||
64 | |-------------------------------------------------------------------------- | ||
65 | | | ||
66 | | Here we define connection settings for PostgreSQL database. | ||
67 | | | ||
68 | | npm i --save pg | ||
69 | | | ||
70 | */ | ||
71 | pg: { | ||
72 | client: 'pg', | ||
73 | connection: { | ||
74 | host: Env.get('DB_HOST', 'localhost'), | ||
75 | port: Env.get('DB_PORT', ''), | ||
76 | user: Env.get('DB_USER', 'root'), | ||
77 | password: Env.get('DB_PASSWORD', ''), | ||
78 | database: Env.get('DB_DATABASE', 'adonis'), | ||
79 | }, | ||
80 | debug: Env.get('DB_DEBUG', false), | ||
81 | }, | ||
82 | }; | ||