-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
39 lines (33 loc) · 1.42 KB
/
index.js
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
32
33
34
35
36
37
38
39
/**
* This code is closed source and Confidential and Proprietary to
* Appcelerator, Inc. All Rights Reserved. This code MUST not be
* modified, copy or otherwise redistributed without expression
* written permission of Appcelerator. This file is licensed as
* part of the Appcelerator Platform and governed under the terms
* of the Appcelerator license agreement.
*/
// always load our bundled request-ssl, not one up the food chain.
var request = require('./node_modules/request-ssl'),
path = require('path');
// load up the fingerprints from our local directory
request.addFingerprintDirectory(path.join(__dirname,'fingerprints'));
// fall back to support a fingerprint list from ENV
// these should overwrite any built in ones. this is useful
// if we need to field augment any fingerprints or add customer specific
// fingerprints such as for VPC or Private Cloud
if (process.env.APPC_FINGERPRINT_DIRECTORY) {
request.addFingerprintDirectory(process.env.APPC_FINGERPRINT_DIRECTORY);
}
// register a request initializer function that will fetch our latest AppC fingerprints
request.registerInitializer(function(callback){
var fetch = require('./fetch');
fetch(function(err){
if (err) {
console.error('Error fetching Appcelerator SSL fingerprints. '+err);
}
if (callback) { return callback(); }
});
});
// expose our domains, helpful in testing
request.APPC_DOMAINS = require('./generate').DOMAINS;
module.exports = request;