Skip to content

Commit

Permalink
Add noUse opt
Browse files Browse the repository at this point in the history
  • Loading branch information
Powersource committed Oct 26, 2023
1 parent 600644d commit 4ce8fc0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ Valid `opts` keys include:
- `opts.db1` (default: `false`)
- uses `ssb-db2` by default, but if `true` will use `ssb-db`
- your can also switch to db1 by setting the ENV `SSB_DB1=true`
- `opts.noUse` (default: `false`)
- if true then the testbot uses neither db1 nor db2 by default, leaving that up to you. Useful e.g. in case you want to control what plugins get imported along with db2.

### `TestBot.use(plugin)`

Expand Down
12 changes: 8 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@ function createTestBot (opts = {}) {
}

const createSbot = require('secret-stack')({ caps })
.use((process.env.SSB_DB1 || opts.db1)
? require('ssb-db')
: require('ssb-db2')
)

if (process.env.SSB_DB1 || opts.db1) {
createSbot.use(require('ssb-db'))
} else if (opts.noUse) {
// no use
} else {
createSbot.use(require('ssb-db2'))
}

plugins.forEach(plugin => createSbot.use(plugin))
plugins = []
Expand Down

0 comments on commit 4ce8fc0

Please sign in to comment.