@pg-boss/dashboard 1.0.1 → 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.
|
@@ -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.0
|
|
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",
|