Skip to content

Commit b75b0e0

Browse files
authored
Allow overriding port and hostname (#47)
* Allow overriding port and hostname * Update server.js * Update Dockerfile
1 parent d3281b8 commit b75b0e0

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ ENV MU_SPARQL_ENDPOINT 'http://database:8890/sparql'
88
ENV MU_APPLICATION_GRAPH 'http://mu.semte.ch/application'
99
ENV NODE_ENV 'production'
1010

11+
ENV HOST '0.0.0.0'
12+
ENV PORT '80'
13+
1114
ENV LOG_SPARQL_ALL 'true'
1215
ENV DEBUG_AUTH_HEADERS 'true'
1316

@@ -19,7 +22,7 @@ COPY . /usr/src/app
1922
RUN chmod +x /usr/src/app/run-development.sh
2023
RUN chmod +x /usr/src/app/build-production.sh
2124

22-
EXPOSE 80
25+
EXPOSE ${PORT}
2326

2427
CMD sh boot.sh
2528

helpers/mu/server.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import bodyParser from 'body-parser';
44

55
var app = express();
66

7+
var port = process.env.PORT || '80';
8+
var hostname = process.env.HOST || '0.0.0.0';
79
var bodySizeLimit = process.env.MAX_BODY_SIZE || '100kb';
810

911
// parse JSONAPI content type
@@ -35,8 +37,8 @@ const errorHandler = function(err, req, res, next) {
3537
};
3638

3739
// start server
38-
app.listen( 80, function() {
39-
console.log(`Starting server on port 80 in ${app.get('env')} mode`);
40+
app.listen( port, hostname, function() {
41+
console.log(`Starting server on ${hostname}:${port} in ${app.get('env')} mode`);
4042
});
4143

4244
export default app;

0 commit comments

Comments
 (0)