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:
|
depends_on:
|
||||||
- mongo
|
- mongo
|
||||||
environment:
|
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:
|
networks:
|
||||||
- appnet
|
- appnet
|
||||||
mongo:
|
mongo:
|
||||||
image: mongo
|
image: mongo
|
||||||
environment:
|
environment:
|
||||||
- MONGO_INITDB_DATABASE=mydatabase
|
- MONGO_INITDB_DATABASE=${MONGO_DATABASE}
|
||||||
- MONGO_INITDB_ROOT_USERNAME=akamai
|
- MONGO_INITDB_ROOT_USERNAME=${MONGO_USERNAME}
|
||||||
- MONGO_INITDB_ROOT_PASSWORD=password
|
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_PASSWORD}
|
||||||
volumes:
|
volumes:
|
||||||
- dbdata:/data/db
|
- dbdata:/data/db
|
||||||
networks:
|
networks:
|
||||||
|
|
|
@ -5,10 +5,10 @@ import { CrawlerModule } from './crawler/crawler.module';
|
||||||
const dotenv = require('dotenv');
|
const dotenv = require('dotenv');
|
||||||
|
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
|
console.log("mongodb://" + process.env.MONGO_USERNAME + ":" + process.env.MONGO_PASSWORD + "@" + process.env.MONGO_HOST + ":" + process.env.MONGO_PORT);
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
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,
|
useNewUrlParser: true,
|
||||||
useUnifiedTopology: true,
|
useUnifiedTopology: true,
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Reference in a new issue