refactor: rename the project to JerapahFlow (jerapah-flow)
Update package names, env vars, cookie, and default ntfy topics while keeping SCRUNNER_* fallbacks. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2,7 +2,12 @@ import fs from "fs";
|
||||
import path from "path";
|
||||
import { DATA_DIR, SERVER_ROOT } from "./paths.js";
|
||||
|
||||
const dbPath = process.env.SCRUNNER_DB_PATH ?? path.join(DATA_DIR, "scrunner.db");
|
||||
const defaultNew = path.join(DATA_DIR, "jerapah-flow.db");
|
||||
const defaultLegacy = path.join(DATA_DIR, "scrunner.db");
|
||||
const dbPath =
|
||||
process.env.JERAPAH_FLOW_DB_PATH ??
|
||||
process.env.SCRUNNER_DB_PATH ??
|
||||
(fs.existsSync(defaultLegacy) && !fs.existsSync(defaultNew) ? defaultLegacy : defaultNew);
|
||||
fs.mkdirSync(path.dirname(dbPath), { recursive: true });
|
||||
|
||||
/** @type {import("knex").Knex.Config} */
|
||||
|
||||
@@ -105,7 +105,7 @@ fs.mkdirSync(LOGS_DIR, { recursive: true });
|
||||
const rollingFile = pino.transport({
|
||||
target: "pino-roll",
|
||||
options: {
|
||||
file: path.join(LOGS_DIR, "scrunner.log"),
|
||||
file: path.join(LOGS_DIR, "jerapah-flow.log"),
|
||||
size: "10m",
|
||||
mkdir: true,
|
||||
limit: { count: 5 },
|
||||
@@ -113,7 +113,7 @@ const rollingFile = pino.transport({
|
||||
});
|
||||
|
||||
export const log = pino(
|
||||
{ level: process.env.SCRUNNER_LOG_LEVEL ?? "debug" },
|
||||
{ level: process.env.JERAPAH_FLOW_LOG_LEVEL ?? process.env.SCRUNNER_LOG_LEVEL ?? "debug" },
|
||||
pino.multistream([
|
||||
{ level: "debug", stream: redactStream(process.stdout) },
|
||||
{ level: "debug", stream: redactStream(rollingFile) },
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@scrunner/server",
|
||||
"name": "@jerapah-flow/server",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
|
||||
@@ -312,7 +312,7 @@ export function createRegistry(server) {
|
||||
pruneTask.destroy();
|
||||
pruneTask = null;
|
||||
}
|
||||
const days = Number(process.env.SCRUNNER_RETENTION_DAYS ?? 30);
|
||||
const days = Number(process.env.JERAPAH_FLOW_RETENTION_DAYS ?? process.env.SCRUNNER_RETENTION_DAYS ?? 30);
|
||||
pruneTask = cron.schedule(
|
||||
"0 0 * * *",
|
||||
async () => {
|
||||
|
||||
@@ -26,11 +26,12 @@ await migrate();
|
||||
enableLogPersistence();
|
||||
|
||||
const jwtSecret =
|
||||
process.env.JERAPAH_FLOW_JWT_SECRET ??
|
||||
process.env.SCRUNNER_JWT_SECRET ??
|
||||
(process.env.NODE_ENV === "production" ? "" : "scrunner-dev-secret");
|
||||
|
||||
if (!jwtSecret) {
|
||||
log.error("SCRUNNER_JWT_SECRET is required in production");
|
||||
log.error("JERAPAH_FLOW_JWT_SECRET is required in production");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@@ -52,7 +53,7 @@ await server.register(jwt, {
|
||||
},
|
||||
});
|
||||
await server.register(cors, {
|
||||
origin: process.env.SCRUNNER_CORS_ORIGIN ?? "http://localhost:5173",
|
||||
origin: process.env.JERAPAH_FLOW_CORS_ORIGIN ?? process.env.SCRUNNER_CORS_ORIGIN ?? "http://localhost:5173",
|
||||
credentials: true,
|
||||
});
|
||||
|
||||
|
||||
@@ -395,7 +395,7 @@ function createScriptSandbox({
|
||||
};
|
||||
|
||||
vm.createContext(sandbox, {
|
||||
name: `scrunner:${workflowName}:${script}`,
|
||||
name: `jerapah-flow:${workflowName}:${script}`,
|
||||
codeGeneration: { strings: false, wasm: false },
|
||||
});
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ async function ntfy(ctx) {
|
||||
}
|
||||
|
||||
const headers = ntfyHeaders(ctx);
|
||||
const ntfyUrl = ctx.config?.url || "https://ntfy.sh/scrunner";
|
||||
const ntfyUrl = ctx.config?.url || "https://ntfy.sh/jerapah-flow";
|
||||
|
||||
if (hasFile) {
|
||||
const filename = ctx.data?.filename || "attachment";
|
||||
@@ -114,7 +114,7 @@ async function ntfy(ctx) {
|
||||
log.info("ntfy sending message to %s", ntfyUrl);
|
||||
log.info("ntfy messsage: %s", truncatedMessage);
|
||||
|
||||
await $axios.post(ntfyUrl, ctx.data?.message || "Hello from scrunner", {
|
||||
await $axios.post(ntfyUrl, ctx.data?.message || "Hello from jerapah-flow", {
|
||||
headers,
|
||||
});
|
||||
}
|
||||
@@ -132,10 +132,11 @@ async function ntfy(ctx) {
|
||||
ntfy.meta = {
|
||||
description: "Send a message or file to an ntfy topic",
|
||||
previewConfigKey: "url",
|
||||
tags: ["channel"],
|
||||
config: {
|
||||
url: {
|
||||
type: "string",
|
||||
default: "https://ntfy.sh/scrunner",
|
||||
default: "https://ntfy.sh/jerapah-flow",
|
||||
description: "ntfy topic URL",
|
||||
},
|
||||
fingerprint: {
|
||||
@@ -166,8 +167,8 @@ ntfy.meta = {
|
||||
sent: { type: "string", description: "Replaces the workflow context with { sent: \"true\" }" },
|
||||
},
|
||||
example: {
|
||||
data: { title: "Hello", message: "Hello from scrunner" },
|
||||
config: { url: "https://ntfy.sh/scrunner", fingerprint: true },
|
||||
data: { title: "Hello", message: "Hello from jerapah-flow" },
|
||||
config: { url: "https://ntfy.sh/jerapah-flow", fingerprint: true },
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -231,6 +231,7 @@ async function sendEmail(ctx) {
|
||||
sendEmail.meta = {
|
||||
description: "Send an email via SMTP (nodemailer); plain text, HTML, or both",
|
||||
previewConfigKey: "from",
|
||||
tags: ["channel"],
|
||||
config: {
|
||||
service: {
|
||||
type: "string",
|
||||
@@ -427,7 +428,7 @@ sendEmail.meta = {
|
||||
to: ["recipient@example.com", "other@example.com"],
|
||||
cc: "manager@example.com",
|
||||
bcc: "audit@example.com",
|
||||
subject: "Hello from scrunner",
|
||||
subject: "Hello from JerapahFlow",
|
||||
text: "This is a plain-text test message.",
|
||||
},
|
||||
config: {
|
||||
|
||||
@@ -11,10 +11,11 @@ const AUTH_TAG_LEN = 16;
|
||||
*/
|
||||
export function resolveSecretsKeyMaterial() {
|
||||
const raw =
|
||||
process.env.JERAPAH_FLOW_SECRETS_KEY ??
|
||||
process.env.SCRUNNER_SECRETS_KEY ??
|
||||
(process.env.NODE_ENV === "production" ? "" : DEV_DEFAULT);
|
||||
if (!raw) {
|
||||
throw new Error("SCRUNNER_SECRETS_KEY is required in production");
|
||||
throw new Error("JERAPAH_FLOW_SECRETS_KEY is required in production");
|
||||
}
|
||||
return raw;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import bcrypt from "bcryptjs";
|
||||
import * as store from "../../store.js";
|
||||
|
||||
export const COOKIE = "scrunner_token";
|
||||
export const COOKIE = "jerapah_flow_token";
|
||||
export const OPEN_API_ROUTES = new Set([
|
||||
"GET /auth/bootstrap",
|
||||
"POST /auth/register",
|
||||
|
||||
@@ -14,7 +14,7 @@ scripts:
|
||||
- fetch-binary.js
|
||||
- script: ntfy.js
|
||||
config:
|
||||
url: https://ntfy.sh/scrunner
|
||||
url: https://ntfy.sh/jerapah-flow
|
||||
|
||||
triggers:
|
||||
- type: HTTP
|
||||
|
||||
@@ -4,7 +4,7 @@ description: |
|
||||
scripts:
|
||||
- script: ntfy.js
|
||||
config:
|
||||
url: https://ntfy.sh/scrunner
|
||||
url: https://ntfy.sh/jerapah-flow
|
||||
triggers:
|
||||
- type: cron
|
||||
schedule: "*/20 * * * *"
|
||||
|
||||
@@ -21,7 +21,7 @@ scripts:
|
||||
}
|
||||
- script: ntfy.js
|
||||
config:
|
||||
url: https://ntfy.sh/scrunner
|
||||
url: https://ntfy.sh/jerapah-flow
|
||||
|
||||
triggers:
|
||||
- type: HTTP
|
||||
|
||||
@@ -8,7 +8,7 @@ scripts:
|
||||
name: send-gmail
|
||||
expression: |
|
||||
{
|
||||
"subject": "scrunner test",
|
||||
"subject": "JerapahFlow test",
|
||||
"text": "Hello from test-send-gmail",
|
||||
"html": "<p>Hello from <strong>test-send-gmail</strong></p>"
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ scripts:
|
||||
script: ntfy.js
|
||||
needs: [compose]
|
||||
config:
|
||||
url: https://ntfy.sh/scrunner
|
||||
url: https://ntfy.sh/jerapah-flow
|
||||
|
||||
triggers:
|
||||
- type: HTTP
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@scrunner/web",
|
||||
"name": "@jerapah-flow/web",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
|
||||
@@ -27,8 +27,8 @@ export function App() {
|
||||
function onUnauthorized() {
|
||||
qc.setQueryData(["me"], null);
|
||||
}
|
||||
window.addEventListener("scrunner:unauthorized", onUnauthorized);
|
||||
return () => window.removeEventListener("scrunner:unauthorized", onUnauthorized);
|
||||
window.addEventListener("jerapah-flow:unauthorized", onUnauthorized);
|
||||
return () => window.removeEventListener("jerapah-flow:unauthorized", onUnauthorized);
|
||||
}, [qc]);
|
||||
|
||||
const user = me.data?.user;
|
||||
|
||||
@@ -11,7 +11,7 @@ api.interceptors.response.use(
|
||||
const url = err.config?.url ?? "";
|
||||
const isAuthCall = url.includes("/auth/login") || url.includes("/auth/register") || url.includes("/auth/me") || url.includes("/auth/bootstrap");
|
||||
if (err.response?.status === 401 && !isAuthCall) {
|
||||
window.dispatchEvent(new Event("scrunner:unauthorized"));
|
||||
window.dispatchEvent(new Event("jerapah-flow:unauthorized"));
|
||||
}
|
||||
return Promise.reject(err);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user