Skip to content

Commit eadec61

Browse files
Merge pull request #9 from boehm-gipmbh/main
Fix issue #8 METABASE_DASHBOARD_PATH env var not used and makke port variable because defaul 8080 cause problem with webpack-dev
2 parents 5c7a883 + 2f20e1e commit eadec61

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Diff for: README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ Start the server by running:
7979
node index.js
8080
```
8181

82-
The app runs by default on port 8080.
82+
The app runs by default on port 8080. If you want to run it on a different port, set the `PORT` environment variable:
83+
```sh
84+
export PORT=8081
85+
```
86+
8387

8488
Visit [http://localhost:8080/analytics](localhost:8080/analytics) and sign in with the following credentials:
8589

Diff for: index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ const METABASE_SITE_URL =
55
const METABASE_JWT_SHARED_SECRET =
66
process.env.METABASE_JWT_SHARED_SECRET ||
77
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";
8-
8+
const METABASE_DASHBOARD_PATH =
9+
process.env.METABASE_DASHBOARD_PATH || "/dashboard/1";
910
const mods = "logo=false";
1011

1112
/**
@@ -130,8 +131,6 @@ app.get("/", function (req, res) {
130131
});
131132

132133
app.get("/analytics", restrict, function (req, res) {
133-
// replace ID "1" with the ID number in the path of your dashboard in Metabase.
134-
const METABASE_DASHBOARD_PATH = "/dashboard/1";
135134
var iframeUrl = `/sso/metabase?return_to=${METABASE_DASHBOARD_PATH}`;
136135
res.send(
137136
`<iframe src="${iframeUrl}" frameborder="0" width="1280" height="1000" allowtransparency></iframe>`
@@ -195,7 +194,8 @@ app.get("/sso/metabase", restrict, (req, res) => {
195194
res.redirect(ssoUrl);
196195
});
197196

198-
const PORT = 8080;
197+
const PORT =
198+
process.env.PORT || 8080;
199199
if (!module.parent) {
200200
app.listen(PORT);
201201
console.log(`Express started serving on port ${PORT}`);

0 commit comments

Comments
 (0)