Skip to content

Commit 1773048

Browse files
committed
Remove assumption that server is run from root
Previously, reading the deployment_sha file assumed that the server is always run via `node server.js` from the root directory of the service and would crash if this is not the case. In some environments, we may not want to invoke the service in that way, for example because we want to provide an absolute path to the server.js file. This change supports that use-case.
1 parent 327df67 commit 1773048

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

controllers/ops.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
"use strict";
22

33
let fs = require('fs');
4+
let path = require('path');
45

56
let services = require('../services');
67

78
let deploymentSHA;
8-
fs.readFile('./deployment_sha', 'utf8', (err, sha) => {
9+
fs.readFile(path.join(__dirname, '..', 'deployment_sha'), 'utf8', (err, sha) => {
910
deploymentSHA = sha.trim();
1011
});
1112

0 commit comments

Comments
 (0)