-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JS driver v1.3.0-beta01: Checking in transpiled files for bower
- Loading branch information
Showing
20 changed files
with
12,215 additions
and
4,756 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,87 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
|
||
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); | ||
|
||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | ||
|
||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
|
||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
|
||
var _features = require('./features'); | ||
|
||
var _features2 = _interopRequireDefault(_features); | ||
|
||
var _error = require('../error'); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
|
||
/** | ||
* Copyright (c) 2002-2017 "Neo Technology,"," | ||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
var ChannelConfig = function () { | ||
function ChannelConfig(host, port, driverConfig, connectionErrorCode) { | ||
(0, _classCallCheck3.default)(this, ChannelConfig); | ||
|
||
this.host = host; | ||
this.port = port; | ||
this.encrypted = ChannelConfig._extractEncrypted(driverConfig); | ||
this.trust = ChannelConfig._extractTrust(driverConfig); | ||
this.trustedCertificates = ChannelConfig._extractTrustedCertificates(driverConfig); | ||
this.knownHostsPath = ChannelConfig._extractKnownHostsPath(driverConfig); | ||
this.connectionErrorCode = connectionErrorCode || _error.SERVICE_UNAVAILABLE; | ||
} | ||
|
||
(0, _createClass3.default)(ChannelConfig, null, [{ | ||
key: '_extractEncrypted', | ||
value: function _extractEncrypted(driverConfig) { | ||
// check if encryption was configured by the user, use explicit null check because we permit boolean value | ||
var encryptionConfigured = driverConfig.encrypted == null; | ||
// default to using encryption if trust-all-certificates is available | ||
return encryptionConfigured ? (0, _features2.default)('trust_all_certificates') : driverConfig.encrypted; | ||
} | ||
}, { | ||
key: '_extractTrust', | ||
value: function _extractTrust(driverConfig) { | ||
if (driverConfig.trust) { | ||
return driverConfig.trust; | ||
} | ||
// default to using TRUST_ALL_CERTIFICATES if it is available | ||
return (0, _features2.default)('trust_all_certificates') ? 'TRUST_ALL_CERTIFICATES' : 'TRUST_CUSTOM_CA_SIGNED_CERTIFICATES'; | ||
} | ||
}, { | ||
key: '_extractTrustedCertificates', | ||
value: function _extractTrustedCertificates(driverConfig) { | ||
return driverConfig.trustedCertificates || []; | ||
} | ||
}, { | ||
key: '_extractKnownHostsPath', | ||
value: function _extractKnownHostsPath(driverConfig) { | ||
return driverConfig.knownHosts || null; | ||
} | ||
}]); | ||
return ChannelConfig; | ||
}(); | ||
|
||
exports.default = ChannelConfig; | ||
; |
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.