1 | The package has been configured successfully. The database configuration stored inside `config/database.ts` file relies on the following environment variables and hence we recommend validating them.
|
2 |
|
3 | **Open the `env.ts` file and paste the following code inside the `Env.rules` object.**
|
4 |
|
5 | ```ts
|
6 | DB_CONNECTION: Env.schema.string(),
|
7 | ```
|
8 |
|
9 | ## Variables for the MYSQL driver
|
10 |
|
11 | ```ts
|
12 | MYSQL_HOST: Env.schema.string({ format: 'host' }),
|
13 | MYSQL_PORT: Env.schema.number(),
|
14 | MYSQL_USER: Env.schema.string(),
|
15 | MYSQL_PASSWORD: Env.schema.string.optional(),
|
16 | MYSQL_DB_NAME: Env.schema.string(),
|
17 | ```
|
18 |
|
19 | - The `MYSQL_HOST` should always be present and formatted as a valid `host`.
|
20 | - The `MYSQL_PORT` should always be present and a valid number.
|
21 | - The `MYSQL_USER` and `MYSQL_PASSWORD` are required to authenticate with the database server. The password is marked as optional since many local database servers are configured to work without passwords.
|
22 | - The `MYSQL_DB_NAME` is the database name you want to connect with.
|
23 |
|
24 | ## Variables for the PostgreSQL driver
|
25 |
|
26 | ```ts
|
27 | PG_HOST: Env.schema.string({ format: 'host' }),
|
28 | PG_PORT: Env.schema.number(),
|
29 | PG_USER: Env.schema.string(),
|
30 | PG_PASSWORD: Env.schema.string.optional(),
|
31 | PG_DB_NAME: Env.schema.string(),
|
32 | ```
|
33 |
|
34 | ## Variables for the MSSQL driver
|
35 |
|
36 | ```ts
|
37 | MSSQL_SERVER: Env.schema.string({ format: 'host' }),
|
38 | MSSQL_PORT: Env.schema.number(),
|
39 | MSSQL_USER: Env.schema.string(),
|
40 | MSSQL_PASSWORD: Env.schema.string.optional(),
|
41 | MSSQL_DB_NAME: Env.schema.string(),
|
42 | ```
|
43 |
|
44 | ## Variables for the OracleDB driver
|
45 |
|
46 | ```ts
|
47 | ORACLE_HOST: Env.schema.string({ format: 'host' }),
|
48 | ORACLE_PORT: Env.schema.number(),
|
49 | ORACLE_USER: Env.schema.string(),
|
50 | ORACLE_PASSWORD: Env.schema.string.optional(),
|
51 | ORACLE_DB_NAME: Env.schema.string(),
|
52 | ```
|