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
|
||||
/dist
|
||||
/node_modules
|
||||
.env
|
||||
package-lock.json
|
||||
|
||||
# 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": {
|
||||
"@nestjs/common": "^10.0.0",
|
||||
"@nestjs/config": "^3.1.1",
|
||||
"@nestjs/core": "^10.0.0",
|
||||
"@nestjs/platform-express": "^10.0.0",
|
||||
"@nestjs/platform-socket.io": "^10.2.7",
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
import { Module } from "@nestjs/common";
|
||||
import { NotificationModule } from "./notifications/notification.mudule";
|
||||
import { SequelizeModule } from "@nestjs/sequelize";
|
||||
import { ConfigModule } from "@nestjs/config";
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
ConfigModule.forRoot(),
|
||||
SequelizeModule.forRoot({
|
||||
dialect: "mysql",
|
||||
host: "localhost",
|
||||
port: 3306,
|
||||
username: "root",
|
||||
password: "",
|
||||
database: "notification_db",
|
||||
host: process.env.DB_HOST,
|
||||
port: parseInt(process.env.DB_PORT),
|
||||
username: process.env.DB_USERNAME,
|
||||
password: process.env.DB_PASSWORD,
|
||||
database: process.env.DB_NAME,
|
||||
autoLoadModels: true,
|
||||
synchronize: true,
|
||||
}),
|
||||
|
||||
@@ -7,7 +7,7 @@ async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
app.useGlobalPipes(new ValidationPipe());
|
||||
app.useWebSocketAdapter(new IoAdapter(app));
|
||||
await app.listen(3001);
|
||||
await app.listen(parseInt(process.env.PORT));
|
||||
}
|
||||
|
||||
bootstrap();
|
||||
|
||||
Reference in New Issue
Block a user