Skip to content

Commit

Permalink
Limit ops tourl only.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcollier committed Dec 12, 2023
1 parent 8b5cf80 commit 5e12448
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions lib/authn.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,24 @@ const {util: {BedrockError}} = bedrock;

export async function openDatabase(options) {
const config = bedrock.config.mongodb;

let opts;
if(config.url) {
opts = {
// FIXME: temporary experiment
url: `${config.url}?authSource=admin`
};
} else {
// copy the config stuff related to connecting
const opts = {
database: config.name,
authentication: {...config.authentication},
// authSource should be set in connectOptions
connectOptions: {...config.connectOptions},
writeOptions: {...config.writeOptions},
...options
};
opts = {
database: config.name,
authentication: {...config.authentication},
// authSource should be set in connectOptions
connectOptions: {...config.connectOptions},
writeOptions: {...config.writeOptions},
...options
};
}

// if a `url` was not specified, create one from the `config`
if(!opts.url) {
Expand Down

0 comments on commit 5e12448

Please sign in to comment.