Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Pratap2018 committed Jan 18, 2024
1 parent c3e0dbf commit 88e2f2c
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions src/vault/providers/storage.provider.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
import { Logger } from '@nestjs/common';
import { Logger } from '@nestjs/common';
import mongoose, { Connection } from 'mongoose';

export const StorageProvider = {
provide: 'StorageProvider',
useFactory: (): Promise<Connection>=>
mongoose.createConnection(process.env.DB_URL + '/vault').asPromise()
.then((connection)=>{

Logger.log('Connection established', 'StorageProvider');
return connection;
})
.catch((err)=>{
Logger.error('Connection failed', 'StorageProvider');
throw err;
}
)



}
provide: 'StorageProvider',
useFactory: (): Promise<Connection> =>
mongoose
.createConnection(process.env.DB_URL)
.asPromise()
.then((connection) => {
Logger.log('Connection established', 'StorageProvider');
return connection;
})
.catch((err) => {
Logger.error('Connection failed', 'StorageProvider');
throw err;
}),
};

0 comments on commit 88e2f2c

Please sign in to comment.