x-cubed / event-store-client

JS client library for connecting to Event Store over TCP/IP
The Unlicense
71 stars 24 forks source link

Add TLS connection #35

Closed Digi-Cazter closed 5 years ago

Digi-Cazter commented 5 years ago

I've added the ability to connect using TLS

var es_options = {
  host: localhost,
  port: 1113,
  debug: true,
  onConnect: function() {
    console.log('ES Connected!');
  },
  onError: function(e) {
    console.log('onError!');
    console.log(e);
  },
  onClose: function(c) {
    console.log('onClose!');
    console.log(c);
  }
}
var EventStore = require('event-store-client');
var connection = new EventStoreClient.TlsConnection(options);

I've also added tests as well and made sure they passed before creating this.

x-cubed commented 5 years ago

Thanks for the contribution!

I'll need to work on a better way to run the tests, as this change requires further configuration on the Event Store side to pass. I think the easiest approach will be to run the tests in Docker containers, so that we can spin up an Event Store instance with the secure TCP port enabled and a suitable TLS certificate installed.

x-cubed commented 5 years ago

Just to update you, I've pushed a change to the master branch that uses a Docker container to run the tests. We can leverage that for testing the TLS functionality by configuring the Event Store Docker container to start up TLS support on port 1114 and generate a suitable self-signed certificate for it to use.

Feel free to look into hooking this up yourself, otherwise I'll get round to it when I get the chance.

morrislaptop commented 5 years ago

Is this going to be merged?

x-cubed commented 5 years ago

See my comments above. It needs unit tests before I'm happy to merge it.

morrislaptop commented 5 years ago

@Digi-Cazter do you think you'll have time to do this?