Skip to content

Commit 384a9c7

Browse files
committed
Allow specifying http and https ports via environment variables
Issue #3
1 parent ff27ae9 commit 384a9c7

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

Dockerfile

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ WORKDIR /app
44

55
COPY . .
66

7+
ENV HTTP_PORT=80 HTTPS_PORT=443
8+
79
RUN npm install --production
810

911
RUN apk --no-cache add openssl && sh generate-cert.sh && rm -rf /var/cache/apk/*
1012

11-
EXPOSE 80 443
12-
13-
1413
ENTRYPOINT ["node", "./index.js"]
1514
CMD []

index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ const sslOpts = {
5959
cert: require('fs').readFileSync('fullchain.pem'),
6060
};
6161

62-
var httpServer = http.createServer(app).listen(80);
63-
var httpsServer = https.createServer(sslOpts,app).listen(443);
62+
var httpServer = http.createServer(app).listen(process.env.HTTP_PORT || 80);
63+
var httpsServer = https.createServer(sslOpts,app).listen(process.env.HTTPS_PORT || 443);
6464

6565
let calledClose = false;
6666

0 commit comments

Comments
 (0)