move ecdh load into try{}; add fallback override env var

This commit is contained in:
Chad Engler 2015-05-28 06:57:06 -07:00
parent 365674f622
commit 3922b1b4ab
2 changed files with 8 additions and 2 deletions

View File

@ -3,6 +3,8 @@ node_js:
- "0.10"
addons:
firefox: "34.0"
env:
- ECCRYPTO_NO_FALLBACK=1
notifications:
email:
on_success: never

View File

@ -12,10 +12,14 @@ var crypto = require("crypto");
// try to use secp256k1, fallback to browser implementation
try {
var secp256k1 = require("secp256k1");
var ecdh = require("./build/Release/ecdh");
} catch (e) {
if (process.env.ECCRYPTO_NO_FALLBACK) {
throw e;
} else {
return (module.exports = require("./browser"));
}
}
var ecdh = require("./build/Release/ecdh");
function assert(condition, message) {
if (!condition) {