pushing for testing mongoDB
This commit is contained in:
parent
f24234d10e
commit
e04a9dd3b1
3 changed files with 16 additions and 6 deletions
6
.env.example
Normal file
6
.env.example
Normal file
|
@ -0,0 +1,6 @@
|
|||
## DB [MongoDb](https://www.mongodb.com/) ##
|
||||
MONGO_USERNAME=akamai
|
||||
MONGO_PASSWORD=password
|
||||
MONGO_DATABASE=mydatabase
|
||||
MONGO_HOST=mongo
|
||||
MONGO_PORT=27017
|
|
@ -7,15 +7,19 @@ services:
|
|||
depends_on:
|
||||
- mongo
|
||||
environment:
|
||||
- MONGO_URL=mongodb://mongo:27017/mydatabase
|
||||
- MONGO_USERNAME=${MONGO_USERNAME}
|
||||
- MONGO_PASSWORD=${MONGO_PASSWORD}
|
||||
- MONGO_HOST=${MONGO_HOST}
|
||||
- MONGO_PORT=${MONGO_PORT}
|
||||
- MONGO_DATABASE=${MONGO_DATABASE}
|
||||
networks:
|
||||
- appnet
|
||||
mongo:
|
||||
image: mongo
|
||||
environment:
|
||||
- MONGO_INITDB_DATABASE=mydatabase
|
||||
- MONGO_INITDB_ROOT_USERNAME=akamai
|
||||
- MONGO_INITDB_ROOT_PASSWORD=password
|
||||
- MONGO_INITDB_DATABASE=${MONGO_DATABASE}
|
||||
- MONGO_INITDB_ROOT_USERNAME=${MONGO_USERNAME}
|
||||
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_PASSWORD}
|
||||
volumes:
|
||||
- dbdata:/data/db
|
||||
networks:
|
||||
|
|
|
@ -5,10 +5,10 @@ import { CrawlerModule } from './crawler/crawler.module';
|
|||
const dotenv = require('dotenv');
|
||||
|
||||
dotenv.config();
|
||||
|
||||
console.log("mongodb://" + process.env.MONGO_USERNAME + ":" + process.env.MONGO_PASSWORD + "@" + process.env.MONGO_HOST + ":" + process.env.MONGO_PORT);
|
||||
@Module({
|
||||
imports: [
|
||||
MongooseModule.forRoot(process.env.MONGO_URL, {
|
||||
MongooseModule.forRoot("mongodb://" + process.env.MONGO_USERNAME + ":" + process.env.MONGO_PASSWORD + "@" + process.env.MONGO_HOST + ":" + process.env.MONGO_PORT, {
|
||||
useNewUrlParser: true,
|
||||
useUnifiedTopology: true,
|
||||
}),
|
||||
|
|
Loading…
Reference in a new issue