Closed
Description
node-postres supports setting NODE_PG_FORCE_NATIVE
to force the loading of the native client, but there's no way to force it to not load the native client:
if (typeof process.env.NODE_PG_FORCE_NATIVE !== 'undefined') {
module.exports = new PG(require('./native'))
} else {
module.exports = new PG(Client)
// lazy require native module...the native module may not have installed
module.exports.__defineGetter__('native', function () {
delete module.exports.native
var native = null
try {
native = new PG(require('./native'))
} catch (err) {
if (err.code !== 'MODULE_NOT_FOUND') {
throw err
}
/* eslint-disable no-console */
console.error(err.message)
/* eslint-enable no-console */
}
module.exports.native = native
return native
})
}
This can cause spurious warnings about pg-native module not found. See sequelize/sequelize#3781 for an example caused by cloning node-postgres objects.
Potential solution: support a NODE_PG_NO_LOAD_NATIVE
environment variable. Setting this would cause the native
getter to not be defined. Setting both NODE_PG_NO_LOAD_NATIVE
and NODE_PG_FORCE_NATIVE
could throw an error.
I'm happy to throw together a PR if there's support for something like this.
Metadata
Metadata
Assignees
Labels
No labels