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" - "0.10"
addons: addons:
firefox: "34.0" firefox: "34.0"
env:
- ECCRYPTO_NO_FALLBACK=1
notifications: notifications:
email: email:
on_success: never on_success: never

View File

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