Skip to content

Commit 089b2ab

Browse files
hpellodrew-gross
authored andcommitted
allow to set a custom mount path
1 parent bdbb612 commit 089b2ab

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Parse-Dashboard/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ program.option('--appName [appName]', 'the name of the app you would like to man
2020
program.option('--config [config]', 'the path to the configuration file');
2121
program.option('--host [host]', 'the host to run parse-dashboard');
2222
program.option('--port [port]', 'the port to run parse-dashboard');
23+
program.option('--mountPath [mountPath]', 'the mount path to run parse-dashboard');
2324
program.option('--allowInsecureHTTP [allowInsecureHTTP]', 'set this flag when you are running the dashboard behind an HTTPS load balancer or proxy with early SSL termination.');
2425

2526
program.parse(process.argv);
2627

2728
const host = program.host || process.env.HOST || '0.0.0.0';
2829
const port = program.port || process.env.PORT || 4040;
30+
const mountPath = program.mountPath || process.env.MOUNT_PATH || '/';
2931
const allowInsecureHTTP = program.allowInsecureHTTP || process.env.PARSE_DASHBOARD_ALLOW_INSECURE_HTTP;
3032

3133
let explicitConfigFileProvided = !!program.config;
@@ -93,10 +95,10 @@ p.then(config => {
9395

9496
const app = express();
9597

96-
app.use(parseDashboard(config.data, allowInsecureHTTP));
98+
app.use(mountPath, parseDashboard(config.data, allowInsecureHTTP));
9799
// Start the server.
98100
const server = app.listen(port, host, function () {
99-
console.log(`The dashboard is now available at http://${server.address().address}:${server.address().port}/`);
101+
console.log(`The dashboard is now available at http://${server.address().address}:${server.address().port}${mountPath}`);
100102
});
101103
}, error => {
102104
if (error instanceof SyntaxError) {

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ You can launch the dashboard for an app with a single command by supplying an ap
1616
parse-dashboard --appId yourAppId --masterKey yourMasterKey --serverURL "https://example.com/parse" --appName optionalName
1717
```
1818

19-
You can then visit the dashboard in your browser at http://localhost:4040. You may set the host and port by supplying the --host and --port options to parse-dashboard. You can use anything you want as the app name, or leave it out in which case the app ID will be used.
19+
You can then visit the dashboard in your browser at http://localhost:4040. You may set the host, port and mount path by supplying the `--host`, `--port` and `--mountPath` options to parse-dashboard. You can use anything you want as the app name, or leave it out in which case the app ID will be used.
2020

2121
If you want to manage multiple apps from the same dashboard, you can start the dashboard with a config file. For example, you could put your info into a file called `parse-dashboard-config.json` and then start the dashboard using `parse-dashboard --config parse-dashboard-config.json`. The file should match the following format:
2222

0 commit comments

Comments
 (0)