775ac7b58c
you must login with an BTP account in order to see the app
27 lines
716 B
JavaScript
27 lines
716 B
JavaScript
'use strict';
|
|
|
|
var debug = require('debug')('xsenv');
|
|
var path = require('path');
|
|
var fs = require('fs');
|
|
var assert = require('assert');
|
|
var VError = require('verror');
|
|
|
|
exports.loadCertificates = loadCertificates;
|
|
|
|
function loadCertificates(certPath) {
|
|
assert(!certPath || typeof certPath === 'string', 'certPath argument should be a string');
|
|
|
|
certPath = certPath || process.env.XS_CACERT_PATH;
|
|
if (certPath) {
|
|
debug('Loading certificate(s) %s', certPath);
|
|
try {
|
|
return certPath
|
|
.split(path.delimiter)
|
|
.map(function (f) {
|
|
return fs.readFileSync(f);
|
|
});
|
|
} catch (err) {
|
|
throw new VError(err, 'Could not load certificate(s) ' + certPath);
|
|
}
|
|
}
|
|
}
|