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 c475c89 commit 1b31504
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .deploy/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ spec:
value: __DATA_VAULT__
- name: DB_URL
value: "__DB_URL__"
- name: DB_CONFIG
value: "__DB_CONFIG__"
- name: PORT
value: "__PORT__"
- name: LOG_LEVEL
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/image-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ jobs:
run: find .deploy/deployment.yaml -type f -exec sed -i ''s/__DATA_VAULT__/${{ secrets.DATA_VAULT }}/g'' {} \;
- name: "Replace secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i -e "s#__DB_URL__#${{ secrets.DB_URL }}#" {} \;
- name: "Replace secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i -e "s#__DB_CONFIG__#${{ secrets.DB_CONFIG }}#" {} \;
- name: "Replace secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__LOG_LEVEL__#${{ secrets.LOG_LEVEL }}#" {} \;

Expand Down
6 changes: 2 additions & 4 deletions src/user-vault/providers/databaseProviders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,13 @@ export const UserVaultProviders = [
throw new Error('No DB_URL set in env');
}

const uri = `${BASE_DB_PATH}`;
const uri = `${BASE_DB_PATH}/${tenantDB}?retryWrites=true&w=majority`;

Logger.log(
'Before creating new db connection...',
'tenant-mongoose-connections',
);
const newConnectionPerApp = await mongoose
.createConnection(uri)
.useDb(tenantDB);
const newConnectionPerApp = await mongoose.createConnection(uri);

newConnectionPerApp.on('disconnected', () => {
Logger.log(
Expand Down
2 changes: 1 addition & 1 deletion src/vault/providers/storage.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const StorageProvider = {
provide: 'StorageProvider',
useFactory: (): Promise<Connection> =>
mongoose
.createConnection(process.env.DB_URL + '/vault')
.createConnection(process.env.DB_URL + '/vault' + process.env.DB_CONFIG)
.asPromise()
.then((connection) => {
Logger.log('Connection established', 'StorageProvider');
Expand Down

0 comments on commit 1b31504

Please sign in to comment.