implementation of env
This commit is contained in:
9
.env.example
Normal file
9
.env.example
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#app
|
||||||
|
PORT=3023
|
||||||
|
|
||||||
|
#database
|
||||||
|
DB_HOST="localhost"
|
||||||
|
DB_PORT=3306
|
||||||
|
DB_USERNAME="root"
|
||||||
|
DB_PASSWORD=""
|
||||||
|
DB_NAME="notification_db"
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,6 +1,8 @@
|
|||||||
# compiled output
|
# compiled output
|
||||||
/dist
|
/dist
|
||||||
/node_modules
|
/node_modules
|
||||||
|
.env
|
||||||
|
package-lock.json
|
||||||
|
|
||||||
# Logs
|
# Logs
|
||||||
logs
|
logs
|
||||||
|
|||||||
9424
package-lock.json
generated
9424
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -21,6 +21,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nestjs/common": "^10.0.0",
|
"@nestjs/common": "^10.0.0",
|
||||||
|
"@nestjs/config": "^3.1.1",
|
||||||
"@nestjs/core": "^10.0.0",
|
"@nestjs/core": "^10.0.0",
|
||||||
"@nestjs/platform-express": "^10.0.0",
|
"@nestjs/platform-express": "^10.0.0",
|
||||||
"@nestjs/platform-socket.io": "^10.2.7",
|
"@nestjs/platform-socket.io": "^10.2.7",
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
import { Module } from "@nestjs/common";
|
import { Module } from "@nestjs/common";
|
||||||
import { NotificationModule } from "./notifications/notification.mudule";
|
import { NotificationModule } from "./notifications/notification.mudule";
|
||||||
import { SequelizeModule } from "@nestjs/sequelize";
|
import { SequelizeModule } from "@nestjs/sequelize";
|
||||||
|
import { ConfigModule } from "@nestjs/config";
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
|
ConfigModule.forRoot(),
|
||||||
SequelizeModule.forRoot({
|
SequelizeModule.forRoot({
|
||||||
dialect: "mysql",
|
dialect: "mysql",
|
||||||
host: "localhost",
|
host: process.env.DB_HOST,
|
||||||
port: 3306,
|
port: parseInt(process.env.DB_PORT),
|
||||||
username: "root",
|
username: process.env.DB_USERNAME,
|
||||||
password: "",
|
password: process.env.DB_PASSWORD,
|
||||||
database: "notification_db",
|
database: process.env.DB_NAME,
|
||||||
autoLoadModels: true,
|
autoLoadModels: true,
|
||||||
synchronize: true,
|
synchronize: true,
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ async function bootstrap() {
|
|||||||
const app = await NestFactory.create(AppModule);
|
const app = await NestFactory.create(AppModule);
|
||||||
app.useGlobalPipes(new ValidationPipe());
|
app.useGlobalPipes(new ValidationPipe());
|
||||||
app.useWebSocketAdapter(new IoAdapter(app));
|
app.useWebSocketAdapter(new IoAdapter(app));
|
||||||
await app.listen(3001);
|
await app.listen(parseInt(process.env.PORT));
|
||||||
}
|
}
|
||||||
|
|
||||||
bootstrap();
|
bootstrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user