diff options
author | vantezzen <properly@protonmail.com> | 2019-08-22 11:12:36 +0200 |
---|---|---|
committer | vantezzen <properly@protonmail.com> | 2019-08-22 11:12:36 +0200 |
commit | b018adf240679ec59a7344e30be39400f1ecd8af (patch) | |
tree | c076635761667dad302716b498088f1047281e46 /config/database.js | |
download | ferdium-server-b018adf240679ec59a7344e30be39400f1ecd8af.tar.gz ferdium-server-b018adf240679ec59a7344e30be39400f1ecd8af.tar.zst ferdium-server-b018adf240679ec59a7344e30be39400f1ecd8af.zip |
Initial commit
Diffstat (limited to 'config/database.js')
-rw-r--r-- | config/database.js | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/config/database.js b/config/database.js new file mode 100644 index 0000000..a7a2776 --- /dev/null +++ b/config/database.js | |||
@@ -0,0 +1,84 @@ | |||
1 | 'use strict' | ||
2 | |||
3 | /** @type {import('@adonisjs/framework/src/Env')} */ | ||
4 | const Env = use('Env') | ||
5 | |||
6 | /** @type {import('@adonisjs/ignitor/src/Helpers')} */ | ||
7 | const Helpers = use('Helpers') | ||
8 | |||
9 | module.exports = { | ||
10 | /* | ||
11 | |-------------------------------------------------------------------------- | ||
12 | | Default Connection | ||
13 | |-------------------------------------------------------------------------- | ||
14 | | | ||
15 | | Connection defines the default connection settings to be used while | ||
16 | | interacting with SQL databases. | ||
17 | | | ||
18 | */ | ||
19 | connection: Env.get('DB_CONNECTION', 'sqlite'), | ||
20 | |||
21 | /* | ||
22 | |-------------------------------------------------------------------------- | ||
23 | | Sqlite | ||
24 | |-------------------------------------------------------------------------- | ||
25 | | | ||
26 | | Sqlite is a flat file database and can be a good choice for a development | ||
27 | | environment. | ||
28 | | | ||
29 | | npm i --save sqlite3 | ||
30 | | | ||
31 | */ | ||
32 | sqlite: { | ||
33 | client: 'sqlite3', | ||
34 | connection: { | ||
35 | filename: Helpers.databasePath(`${Env.get('DB_DATABASE', 'development')}.sqlite`) | ||
36 | }, | ||
37 | useNullAsDefault: true, | ||
38 | debug: Env.get('DB_DEBUG', false) | ||
39 | }, | ||
40 | |||
41 | /* | ||
42 | |-------------------------------------------------------------------------- | ||
43 | | MySQL | ||
44 | |-------------------------------------------------------------------------- | ||
45 | | | ||
46 | | Here we define connection settings for MySQL database. | ||
47 | | | ||
48 | | npm i --save mysql | ||
49 | | | ||
50 | */ | ||
51 | mysql: { | ||
52 | client: 'mysql', | ||
53 | connection: { | ||
54 | host: Env.get('DB_HOST', 'localhost'), | ||
55 | port: Env.get('DB_PORT', ''), | ||
56 | user: Env.get('DB_USER', 'root'), | ||
57 | password: Env.get('DB_PASSWORD', ''), | ||
58 | database: Env.get('DB_DATABASE', 'adonis') | ||
59 | }, | ||
60 | debug: Env.get('DB_DEBUG', false) | ||
61 | }, | ||
62 | |||
63 | /* | ||
64 | |-------------------------------------------------------------------------- | ||
65 | | PostgreSQL | ||
66 | |-------------------------------------------------------------------------- | ||
67 | | | ||
68 | | Here we define connection settings for PostgreSQL database. | ||
69 | | | ||
70 | | npm i --save pg | ||
71 | | | ||
72 | */ | ||
73 | pg: { | ||
74 | client: 'pg', | ||
75 | connection: { | ||
76 | host: Env.get('DB_HOST', 'localhost'), | ||
77 | port: Env.get('DB_PORT', ''), | ||
78 | user: Env.get('DB_USER', 'root'), | ||
79 | password: Env.get('DB_PASSWORD', ''), | ||
80 | database: Env.get('DB_DATABASE', 'adonis') | ||
81 | }, | ||
82 | debug: Env.get('DB_DEBUG', false) | ||
83 | } | ||
84 | } | ||