Skip to content

Commit

Permalink
fix: parse 'false' in env
Browse files Browse the repository at this point in the history
  • Loading branch information
kalinkrustev committed May 15, 2024
1 parent a7e8c8e commit 539b90f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ module.exports = {
MONGODB_USER: RC.MONGODB.USER,
MONGODB_PASSWORD: RC.MONGODB.PASSWORD,
MONGODB_DATABASE: RC.MONGODB.DATABASE,
MONGODB_DEBUG: (RC.MONGODB.DEBUG === true || RC.MONGODB.DEBUG === 'true'),
MONGODB_DISABLED: (RC.MONGODB.DISABLED === true || RC.MONGODB.DISABLED === 'true'),
MONGODB_DEBUG: RC.MONGODB.DEBUG === true,
MONGODB_DISABLED: RC.MONGODB.DISABLED === true,
AMOUNT: RC.AMOUNT,
EXPIRES_TIMEOUT: RC.EXPIRES_TIMEOUT,
ERROR_HANDLING: RC.ERROR_HANDLING,
Expand Down
11 changes: 0 additions & 11 deletions test/unit/lib/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,5 @@ Test('Config should', configTest => {
test.end()
})

configTest.test('evaluate MONGODB_DISABLED to a boolean if a string', async function (test) {
console.log(Defaults)
const Config = Proxyquire('../../../src/lib/config', {
'../../config/default.json': { ...Defaults, MONGODB: { DISABLED: 'true', DEBUG: 'true' } }
})

test.ok(Config.MONGODB_DISABLED === true)
test.ok(Config.MONGODB_DEBUG === true)
test.end()
})

configTest.end()
})

0 comments on commit 539b90f

Please sign in to comment.