Skip to content

Commit

Permalink
chore: move certs to top-level
Browse files Browse the repository at this point in the history
  • Loading branch information
shakyShane committed Dec 22, 2017
1 parent 4e4d01e commit a4bc2fd
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 259 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
lib/public/socket.io.js
lib/public/socket.io.min.1.6.0.js
lib/templates/**/*
lib/server/certs/**
certs/**
lib/cli/cli-template.js
test/specs/resp-mod/rewrite-links.js
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/server.secure.pfx.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ browserSync.init({
baseDir: "app"
},
https: {
pfx: "lib/server/certs/browsersync.pfx"
pfx: "certs/browsersync.pfx"
}
});

11 changes: 0 additions & 11 deletions lib/cli/help.txt

This file was deleted.

8 changes: 4 additions & 4 deletions lib/server/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ var serveStatic = require("serve-static");
var logger = require("../logger");
var snippetUtils = require("../snippet").utils;
var lrSnippet = require("resp-modifier");
var utils = require("../utils");
var certPath = join(__dirname, "..", "..", "certs");

function getCa (options) {
var caOption = options.getIn(["https", "ca"]);
// if not provided, use Browsersync self-signed
if (typeof caOption === "undefined") {
return fs.readFileSync(join(__dirname, "certs", "server.csr"));
return fs.readFileSync(join(certPath, "server.csr"));
}
// if a string was given, read that file from disk
if (typeof caOption === "string") {
Expand All @@ -37,11 +37,11 @@ function getCa (options) {
}

function getKey(options) {
return fs.readFileSync(options.getIn(["https", "key"]) || join(__dirname, "certs", "server.key"));
return fs.readFileSync(options.getIn(["https", "key"]) || join(certPath, "server.key"));
}

function getCert(options) {
return fs.readFileSync(options.getIn(["https", "cert"]) || join(__dirname, "certs", "server.crt"));
return fs.readFileSync(options.getIn(["https", "cert"]) || join(certPath, "server.crt"));
}

function getHttpsServerDefaults (options) {
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"lib",
"lodash.custom.js",
"client/index",
"client/dist"
"client/dist",
"certs"
],
"engines": {
"node": ">= 0.8.0"
Expand Down Expand Up @@ -87,6 +88,7 @@
"rimraf": "2.5.4",
"sinon": "1.17.5",
"supertest": "2.0.0",
"typescript": "^2.6.2",
"vinyl": "1.2.0"
},
"keywords": [
Expand Down
4 changes: 2 additions & 2 deletions test/specs/e2e/server/e2e.server.secure.custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ describe("E2E TLS server with custom certs test", function () {
baseDir: "test/fixtures"
},
https: {
key: path.resolve("./lib/server/certs/server.key"),
cert: path.resolve("./lib/server/certs/server.crt")
key: path.resolve("./certs/server.key"),
cert: path.resolve("./certs/server.crt")
},
logLevel: "silent",
open: false
Expand Down
2 changes: 1 addition & 1 deletion test/specs/e2e/server/e2e.server.secure.pfx.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe("E2E TLS server with PFX certs test", function () {
baseDir: "test/fixtures"
},
https: {
pfx: path.resolve("./lib/server/certs/browsersync.pfx")
pfx: path.resolve("./certs/browsersync.pfx")
},
logLevel: "silent",
open: false
Expand Down
Loading

0 comments on commit a4bc2fd

Please sign in to comment.