SHARE
TWEET

Untitled

a guest Dec 13th, 2016 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getConnection () {
  2. const options = {
  3. user: 'root',
  4. password: 'pwd',
  5. database: 'dbname',
  6. socketPath: '/cloudsql/project-name:us-central1:name',
  7. ssl: {
  8.    ca: fs.readFileSync(__dirname + '/server-ca.pem'),
  9.    cert: fs.readFileSync(__dirname + '/client-cert.pem'),
  10.    key: fs.readFileSync(__dirname + '/client-key.pem')
  11. }
  12. };
  13.    
  14. Handshake.prototype['HandshakeInitializationPacket'] = function(packet) {
  15.   this._handshakeInitializationPacket = packet;
  16.  
  17.   this._config.protocol41 = packet.protocol41;
  18.  
  19.   var serverSSLSupport = packet.serverCapabilities1 & ClientConstants.CLIENT_SSL;
  20.  
  21.   if (this._config.ssl) {
  22.     if (!serverSSLSupport) {
  23.       var err = new Error('Server does not support secure connection');
  24.  
  25.       err.code = 'HANDSHAKE_NO_SSL_SUPPORT';
  26.       err.fatal = true;
  27.  
  28.       this.end(err);
  29.       return;
  30.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top