Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

force usage of pg.native via environment variable #381

Merged
merged 7 commits into from
Jun 29, 2013

Conversation

hoegaarden
Copy link
Contributor

I want to force the usage of the native client without changing any code. This is especially useful when using modules which use node-postgresql.
With this patch node-postgres uses the native client when the environment variable NODE_PG_FORCE_NATIVE is set.

@brianc
Copy link
Owner

brianc commented Jun 26, 2013

I think this is slightly hackish, but I can understand the use-case. The only thing missing is some sort of test. Maybe something like this:

process.env.NODE_PG_FORCE_NATIVE = true;
var pg = require('../../lib/pg');
//figure out some how this is the native binding
assert(pg instanceof require('../../lib/native/index));

That's psuedocode, but close to what the test should be I think.

Each test file runs in its own process so you wont affect 'global state' by modifying the environment variable there since the process is only alive while the test file runs. Just add the test under test/integration/client somewhere

@hoegaarden
Copy link
Contributor Author

Ok. I just fixed another bug (for 0.8.x). I'll add a testcase for my changes ...

@hoegaarden
Copy link
Contributor Author

OK?

@brianc
Copy link
Owner

brianc commented Jun 29, 2013

Sorry for the delay. I am at nodeconf and have been busy plus there is limited internet. I will merge this by end of weekend.

@brianc
Copy link
Owner

brianc commented Jun 29, 2013

perfect. 👍

brianc added a commit that referenced this pull request Jun 29, 2013
force usage of pg.native via environment variable
@brianc brianc merged commit a943500 into brianc:master Jun 29, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants