diff options
author | 2021-08-13 00:45:01 +0530 | |
---|---|---|
committer | 2021-08-13 00:45:01 +0530 | |
commit | 2d27d5e66649d4f5baf127a53ee5ae524eae3a59 (patch) | |
tree | c592ea219ac8cd987fc367f57b54034c450ab2ab /src/internal-server/config/database.js | |
parent | Ferdi v5.6.0 (diff) | |
parent | 5.6.1-nightly.24 [skip ci] (diff) | |
download | ferdium-app-2d27d5e66649d4f5baf127a53ee5ae524eae3a59.tar.gz ferdium-app-2d27d5e66649d4f5baf127a53ee5ae524eae3a59.tar.zst ferdium-app-2d27d5e66649d4f5baf127a53ee5ae524eae3a59.zip |
chore: merge from nightly branch into release branch in prep for next beta
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 | }; | ||