Skip to content

Commit a330438

Browse files
committed
Merge pull request #238 from CodeYellowBV/certs-via-cli
Add --cert, --key and --cacert options to CLI.
2 parents bd425b8 + 1f0cc17 commit a330438

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

bin/webpack-dev-server.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
var path = require("path");
44
var url = require("url");
5+
var fs = require("fs");
56

67
// Local version replaces global one
78
try {
@@ -29,6 +30,12 @@ var optimist = require("optimist")
2930

3031
.boolean("https").describe("https")
3132

33+
.string("key").describe("key", "Path to a SSL key.")
34+
35+
.string("cert").describe("cert", "Path to a SSL certificate.")
36+
37+
.string("cacert").describe("cacert", "Path to a SSL CA certificate.")
38+
3239
.string("content-base").describe("content-base", "A directory or URL to serve HTML content from.")
3340

3441
.string("content-base-target").describe("content-base-target", "Proxy requests to this target.")
@@ -106,6 +113,15 @@ if(argv["quiet"])
106113
if(argv["https"])
107114
options.https = true;
108115

116+
if(argv["cert"])
117+
options.cert = fs.readFileSync(path.resolve(argv["cert"]));
118+
119+
if(argv["key"])
120+
options.key = fs.readFileSync(path.resolve(argv["key"]));
121+
122+
if(argv["cacert"])
123+
options.cacert = fs.readFileSync(path.resolve(argv["cacert"]));
124+
109125
if(argv["inline"])
110126
options.inline = true;
111127

0 commit comments

Comments
 (0)