Commit 526ece2 1 parent 3c88163 commit 526ece2 Copy full SHA for 526ece2
File tree 3 files changed +11
-23
lines changed
3 files changed +11
-23
lines changed Original file line number Diff line number Diff line change 16
16
17
17
module . exports = function ( RED ) {
18
18
const SERVICE_IDENTIFIER = 'gateway-a.watsonplatform.net' ;
19
- var watson = require ( 'watson-developer-cloud' ) ;
20
-
21
- var payloadutils = require ( '../../utilities/payload-utils' ) ,
22
- serviceutils = require ( '../../utilities/service-utils' ) ;
19
+ var watson = require ( 'watson-developer-cloud' ) ,
20
+ payloadutils = require ( '../../utilities/payload-utils' ) ,
21
+ serviceutils = require ( '../../utilities/service-utils' ) ,
22
+ apikey , s_apikey ,
23
+ service = serviceutils . getServiceCredsAlchemy ( SERVICE_IDENTIFIER ) ;
23
24
24
25
// Require the Cloud Foundry Module to pull credentials from bound service
25
26
// If they are found then the api key is stored in the variable s_apikey.
@@ -30,14 +31,6 @@ module.exports = function (RED) {
30
31
// user who, when he errenously enters bad credentials, can't figure out why
31
32
// the edited ones are not being taken.
32
33
33
- // Taking this line out as codacy was complaining about it.
34
- // var services = cfenv.getAppEnv().services;
35
- var service ;
36
-
37
- var apikey , s_apikey ;
38
-
39
- var service = serviceutils . getServiceCredsAlchemy ( SERVICE_IDENTIFIER ) ;
40
-
41
34
if ( service ) {
42
35
s_apikey = service . apikey ;
43
36
}
Original file line number Diff line number Diff line change @@ -38,7 +38,9 @@ module.exports = function (RED) {
38
38
var watson = require ( 'watson-developer-cloud' ) ;
39
39
40
40
var payloadutils = require ( '../../utilities/payload-utils' ) ,
41
- serviceutils = require ( '../../utilities/service-utils' ) ;
41
+ serviceutils = require ( '../../utilities/service-utils' ) ,
42
+ apikey , s_apikey ,
43
+ service = serviceutils . getServiceCredsAlchemy ( SERVICE_IDENTIFIER ) ;
42
44
43
45
44
46
// Require the Cloud Foundry Module to pull credentials from bound service
@@ -50,14 +52,6 @@ module.exports = function (RED) {
50
52
// user who, when he errenously enters bad credentials, can't figure out why
51
53
// the edited ones are not being taken.
52
54
53
- // Taking this line out as codacy was complaining about it.
54
- // var services = cfenv.getAppEnv().services;
55
- var service ;
56
-
57
- var apikey , s_apikey ;
58
-
59
- var service = serviceutils . getServiceCredsAlchemy ( SERVICE_IDENTIFIER ) ;
60
-
61
55
if ( service ) {
62
56
s_apikey = service . apikey ;
63
57
}
Original file line number Diff line number Diff line change @@ -23,8 +23,9 @@ ServiceUtils.prototype = {
23
23
// that the url associated with the service, contains the matched
24
24
// input value, hence reducing the chances of a false match.
25
25
checkCFForService : function ( serviceName , returnBoolean , alchemyRegex ) {
26
- var regex = alchemyRegex ? RegExp ( '(http|https)(://)(' + serviceName + ').*' )
27
- : RegExp ( '(http|https)(://)([^\/]+)(/)(' + serviceName + ').*' ) ;
26
+ var regex = alchemyRegex ?
27
+ RegExp ( '(http|https)(://)(' + serviceName + ').*' ) :
28
+ RegExp ( '(http|https)(://)([^\/]+)(/)(' + serviceName + ').*' ) ;
28
29
29
30
var services = appEnv . getServices ( ) ;
30
31
You can’t perform that action at this time.
0 commit comments