-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjsUtils.js
More file actions
31 lines (26 loc) · 917 Bytes
/
jsUtils.js
File metadata and controls
31 lines (26 loc) · 917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function fn() {
return {
getAuthHeaders: function (tokenValue) {
return {
[this.getAuthHeaderKey()]: this.getAuthHeaderValue(tokenValue)
}
},
getAuthHeaderKey: function () {
return this.shouldUseFakeExternalDependencies()
? 'X-DEBUG-TOKEN'
: 'Authorization';
},
getAuthHeaderValue: function (tokenValue) {
return this.shouldUseFakeExternalDependencies()
? tokenValue
: 'Bearer ' + tokenValue;
},
shouldUseFakeExternalDependencies: function () {
return this.getEnvVariable('SHOULD_USE_FAKE_EXTERNAL_DEPENDENCIES') === 'true';
},
getEnvVariable: function (variable) {
var System = Java.type('java.lang.System');
return System.getenv(variable);
},
}
}