Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion environment/dev-local.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BOOT_NODE_ADDRESS=ws://127.0.0.1:9944
MONGODB_HOST=localhost
MONGODB_HOST=mongodb://localhost/devnet?authSource=admin
MONGODB_USER=mongoadmin
MONGODB_PASS=secret
2 changes: 1 addition & 1 deletion environment/test.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
BOOT_NODE_ADDRESS=ws://127.0.0.1:9944
MONGODB_HOST=localhost
MONGODB_HOST=mongodb://localhost/devnet?authSource=admin
MONGODB_USER=''
MONGODB_PASS=''
SECRET=thisIsASecret
11 changes: 10 additions & 1 deletion src/mongoose/mongoose.module.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
import fs from 'fs'
import { MongooseModule } from '@nestjs/mongoose'
import { ConfigModule } from '../config/config.module'
import { ConfigService } from '../config/config.service'

// Specify the Amazon DocumentDB cert
const ca = [fs.readFileSync(`${__dirname}/rds-combined-ca-bundle.pem`)]

export const MyMongooseModule = MongooseModule.forRootAsync({
imports: [ConfigModule],
useFactory: (configService: ConfigService) => {
const host = configService.get('MONGODB_HOST')
const user = configService.get('MONGODB_USER')
const pass = configService.get('MONGODB_PASS')
const ssl = configService.get('MONGODB_SSL')

return {
uri: `mongodb://${host}/registry?authSource=admin`,
uri: host,
user,
pass,
sslValidate: ssl ? true : false,
sslCA: ca,
useNewUrlParser: true,
}
},
inject: [ConfigService],
Expand Down
Loading