-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove mode support use only configuration file
- Loading branch information
Serhat Can
committed
Jun 21, 2016
1 parent
2a82e11
commit a0bf2a4
Showing
5 changed files
with
125 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
"use strict"; | ||
|
||
var isArray = Array.isArray; | ||
var hasOwn = Object.prototype.hasOwnProperty; | ||
|
||
/** | ||
* Recursively copies given object into a new object. Helper method for merge | ||
*/ | ||
function clone(v) { | ||
if (v === null || typeof v !== "object") { | ||
return v; | ||
} | ||
|
||
if (isArray(v)) { | ||
var arr = v.slice(); | ||
for (var i = 0; i < v.length; i++) { | ||
arr[i] = clone(arr[i]); | ||
} | ||
return arr; | ||
} | ||
else { | ||
var obj = {}; | ||
for (var k in v) { | ||
obj[k] = clone(v[k]); | ||
} | ||
return obj; | ||
} | ||
} | ||
|
||
/** | ||
* Merges two Objects recursively, setting property of obj1 to those of obj2 | ||
* and creating property as necessary. | ||
*/ | ||
var merge = exports.merge = function merge(obj1, obj2, appendOnly) { | ||
|
||
if (obj1 === null || typeof obj1 !== "object") { | ||
throw new TypeError("merge() - first parameter has to be an object, not " + typeof obj1 + "."); | ||
} | ||
|
||
if (obj2 === null || typeof obj2 !== "object") { | ||
throw new TypeError("merge() - first parameter has to be an object, not " + typeof obj2 + "."); | ||
} | ||
|
||
if (isArray(obj1) || isArray(obj2)) { | ||
throw new TypeError("merge() - Unsupported for arrays."); | ||
} | ||
|
||
for (var k in obj2) { | ||
var obj1Val, obj2Val = obj2[k]; | ||
if (hasOwn.call(obj1, k)) { | ||
if (!appendOnly) { | ||
obj1Val = obj1[k]; | ||
if (obj1Val !== null && typeof obj1Val === "object" && | ||
obj2Val !== null && typeof obj2Val === "object") { | ||
merge(obj1Val, obj2Val); | ||
} | ||
else { | ||
obj1[k] = clone(obj2Val); | ||
} | ||
} | ||
} | ||
else { | ||
obj1[k] = clone(obj2Val); | ||
} | ||
} | ||
return obj1; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,8 @@ | ||
"use strict"; | ||
|
||
var opsgenie = require('../'); | ||
// var api_key = require('./config').api_key; | ||
|
||
opsgenie.configure({ | ||
'mode': 'lab', | ||
'host': 'http://localhost:9000', | ||
'api_key': "91e58022-8be4-4590-a4f0-0d4030bd9b0d" | ||
}); | ||
|
||
// sample conf for localhost | ||
/* | ||
{ | ||
'mode': 'localhost', | ||
'host': 'localhost:9000', | ||
'api_key': 'local_key' | ||
}*/ | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.