diff --git a/.env.example b/.env.example index 243096a..1032aa6 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,4 @@ MY_SQL_USER=root MY_SQL_PASSWORD=1234567890 MY_SQL_DB=educa7ls +MY_SQL_PORT=3306 diff --git a/.gitignore b/.gitignore index 09a2726..3e58864 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ .env.production +eegsac.zip + # Logs logs *.log diff --git a/src/app.module.ts b/src/app.module.ts index 147e228..cc09119 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -9,13 +9,17 @@ import { PersonController } from "./controller/person/person.controller"; import { PersonService } from "./controller/person/person.service"; import { SubjectController } from "./controller/subject/subject.controller"; import { SubjectService } from "./controller/subject/subject.service"; +import * as dotenv from "dotenv"; + +// Must be done before initializing DB. +dotenv.config(); @Module({ imports: [ TypeOrmModule.forRoot({ type: "mysql", host: "localhost", - port: 3306, + port: parseInt(process.env.MY_SQL_PORT ?? "3306", 10), username: process.env.MY_SQL_USER, password: process.env.MY_SQL_PASSWORD, database: process.env.MY_SQL_DB,