@pg-boss/dashboard 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +11 -17
- package/build/server/assets/auth.server-DgTIakNo.js +17 -0
- package/build/server/index.js +5 -0
- package/package.json +3 -2
package/bin/cli.js
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { fileURLToPath } from 'url'
|
|
3
|
+
import { dirname, join } from 'path'
|
|
4
|
+
import process from 'process'
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
// Set PORT and HOST before importing the server
|
|
7
|
+
if (!process.env.PORT) process.env.PORT = '3000'
|
|
8
|
+
if (!process.env.HOST) process.env.HOST = '0.0.0.0'
|
|
6
9
|
|
|
7
|
-
//
|
|
8
|
-
const
|
|
10
|
+
// Change to package directory so relative paths in the build resolve correctly
|
|
11
|
+
const packageRoot = join(dirname(fileURLToPath(import.meta.url)), '..')
|
|
12
|
+
process.chdir(packageRoot)
|
|
9
13
|
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
{
|
|
13
|
-
fetch: server.fetch,
|
|
14
|
-
port: parseInt(String(port), 10),
|
|
15
|
-
hostname: host,
|
|
16
|
-
},
|
|
17
|
-
(info) => {
|
|
18
|
-
console.log(`pg-boss dashboard server running at http://${info.address}:${info.port}`)
|
|
19
|
-
console.log('Open your browser to view the dashboard')
|
|
20
|
-
}
|
|
21
|
-
)
|
|
14
|
+
// Import the built server - it will auto-start in production mode
|
|
15
|
+
await import('../build/server/index.js')
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { basicAuth } from "hono/basic-auth";
|
|
2
|
+
function configureAuth(app) {
|
|
3
|
+
const username = process.env.PGBOSS_DASHBOARD_AUTH_USERNAME;
|
|
4
|
+
const password = process.env.PGBOSS_DASHBOARD_AUTH_PASSWORD;
|
|
5
|
+
if (username && !password) {
|
|
6
|
+
throw new Error("PGBOSS_DASHBOARD_AUTH_PASSWORD is required when PGBOSS_DASHBOARD_AUTH_USERNAME is set");
|
|
7
|
+
}
|
|
8
|
+
if (!username && password) {
|
|
9
|
+
throw new Error("PGBOSS_DASHBOARD_AUTH_USERNAME is required when PGBOSS_DASHBOARD_AUTH_PASSWORD is set");
|
|
10
|
+
}
|
|
11
|
+
if (username && password) {
|
|
12
|
+
app.use(basicAuth({ username, password }));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
configureAuth as c
|
|
17
|
+
};
|
package/build/server/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { c as createHonoServer } from "./assets/node-DzjK5u9i.js";
|
|
2
|
+
import { c as configureAuth } from "./assets/auth.server-DgTIakNo.js";
|
|
2
3
|
import { g as getDatabaseConfigs, f as findDatabaseById } from "./assets/config.server-CARiqCUE.js";
|
|
3
4
|
import "hono/factory";
|
|
4
5
|
import "@hono/node-server";
|
|
@@ -6,7 +7,11 @@ import "@hono/node-server/serve-static";
|
|
|
6
7
|
import "hono";
|
|
7
8
|
import "hono/logger";
|
|
8
9
|
import "react-router";
|
|
10
|
+
import "hono/basic-auth";
|
|
9
11
|
const server = createHonoServer({
|
|
12
|
+
beforeAll(app) {
|
|
13
|
+
configureAuth(app);
|
|
14
|
+
},
|
|
10
15
|
getLoadContext(c) {
|
|
11
16
|
const databases = getDatabaseConfigs();
|
|
12
17
|
const url = new URL(c.req.url);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pg-boss/dashboard",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Web dashboard for monitoring and managing pg-boss job queues",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pg-boss",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
],
|
|
25
25
|
"scripts": {
|
|
26
26
|
"dev": "cross-env DATABASE_URL=postgres://postgres:postgres@127.0.0.1:5432/pgboss react-router dev",
|
|
27
|
+
"dev:auth": "cross-env DATABASE_URL=postgres://postgres:postgres@127.0.0.1:5432/pgboss PGBOSS_DASHBOARD_AUTH_USERNAME=admin PGBOSS_DASHBOARD_AUTH_PASSWORD=admin react-router dev",
|
|
27
28
|
"dev:init-db": "cross-env DATABASE_URL=postgres://postgres:postgres@127.0.0.1:5432/pgboss tsx scripts/init-dev-db.ts",
|
|
28
29
|
"dev:worker": "cross-env DATABASE_URL=postgres://postgres:postgres@127.0.0.1:5432/pgboss tsx scripts/worker.ts",
|
|
29
30
|
"build": "react-router build",
|
|
@@ -49,7 +50,7 @@
|
|
|
49
50
|
"isbot": "^5.1.34",
|
|
50
51
|
"lucide-react": "^0.563.0",
|
|
51
52
|
"pg": "^8.18.0",
|
|
52
|
-
"pg-boss": "^12.11.
|
|
53
|
+
"pg-boss": "^12.11.1",
|
|
53
54
|
"react": "^19.2.4",
|
|
54
55
|
"react-dom": "^19.2.4",
|
|
55
56
|
"react-router": "^7.13.0",
|