Skip to content
This repository has been archived by the owner on Jan 1, 2024. It is now read-only.

Commit

Permalink
feat(server/config): add default ssl
Browse files Browse the repository at this point in the history
feat(server/config): add default ssl
  • Loading branch information
Metnew committed Sep 30, 2017
1 parent 4cafcb5 commit 86fe771
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/server/config/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
import path from 'path'
import {readFileSync} from 'fs'
// If you want quick SSL for prototyping:
// import pseudossl from 'pseudossl'
// NOTE: you should use own SSL certs in production!
let key = ''
let cert = ''


if (process.env.NODE_ENV === 'development') {
// REMOVE THESE LINES IF YOU HAVE VALID CERT AND KEY FOR DEVELOPMENT
const pseudossl = require('pseudossl')
key = pseudossl.key
cert = pseudossl.cert
} else {
key = readFileSync(path.join(__dirname, './ssl/server.key'))
cert = readFileSync(path.join(__dirname, './ssl/server.crt'))
}

export const serverOptions = {
key: readFileSync(path.join(__dirname, './ssl/server.key')),
cert: readFileSync(path.join(__dirname, './ssl/server.crt'))
key,
cert
}

0 comments on commit 86fe771

Please sign in to comment.