Skip to content

Commit

Permalink
Merge pull request #17 from KillrVideo/support_for_ssl
Browse files Browse the repository at this point in the history
Support for ssl
  • Loading branch information
SonicDMG authored Aug 23, 2018
2 parents 928bd47 + c58c0ec commit fac026b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ WORKDIR /opt/killrvideo-web
# Copy package.json for dependencies
COPY package.json /opt/killrvideo-web/
COPY npm-shrinkwrap.json /opt/killrvideo-web/

# Add dependencies for node-gyp, then run npm install and remove dependencies
RUN set -x \
&& apt-get update \
Expand Down
2 changes: 1 addition & 1 deletion npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "killrvideo-web",
"version": "1.2.8",
"version": "2.1.0",
"description": "Web Server and UI for the KillrVideo reference application",
"main": "dist/server/index.js",
"scripts": {
Expand Down
25 changes: 24 additions & 1 deletion src/server/utils/cassandra.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,30 @@ export function getCassandraClientAsync(keyspace, dseUsername, dsePassword) {
} else {
logger.info('No detected username/password combination was passed in. DSE cluster authentication method was NOT executed.');
}


let Filesystem = require("fs");
let sslStat = process.env.KILLRVIDEO_ENABLE_SSL;
logger.info(sslStat);

if (sslStat === "true") {
logger.info('SSL is configured to be on.');
if (Filesystem.existsSync('cassandra.cert')) {
clientOpts.sslOptions = {
ca: [Filesystem.readFileSync('cassandra.cert')],
// validate server cert and reject if not trusted
requestCert: true,
rejectUnauthorized: true
};
logger.info('Found cert, read file sync.')
} else {
logger.info('No cert found, SSL not enabled.')
}
} else if (sslStat === "false") {
logger.info('SSL is configured to be off.')
} else {
logger.info('SSL is not configured, should it be set?')
}

// Create a client and promisify it
let client = new Client(clientOpts);
client = Promise.promisifyAll(client);
Expand Down

0 comments on commit fac026b

Please sign in to comment.