Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
build: add environment variables for novu api url
Brad Barbinbf5d0d37767f
diff --git a/apps/erp/app/hooks/useNotifications.tsx b/apps/erp/app/hooks/useNotifications.tsxindex 452b18d458..e24f2a9767 100644--- a/apps/erp/app/hooks/useNotifications.tsx+++ b/apps/erp/app/hooks/useNotifications.tsx@@ -1,4 +1,4 @@-import { NOVU_APPLICATION_ID } from "@carbon/auth";+import { NOVU_API_URL, NOVU_APPLICATION_ID } from "@carbon/auth";import { useMount } from "@carbon/react";import type { IMessage } from "@novu/headless";import { HeadlessService } from "@novu/headless";@@ -130,7 +130,11 @@ export function useNotifications({useEffect(() => {if (subscriberId && !headlessServiceRef.current) {const headlessService = new HeadlessService({- applicationIdentifier: NOVU_APPLICATION_ID,+ applicationIdentifier: NOVU_APPLICATION_ID!,+ backendUrl: NOVU_API_URL,+ socketUrl: NOVU_API_URL.includes("eu.")+ ? "wss://eu.socket.novu.co"+ : undefined,subscriberId});diff --git a/apps/erp/app/root.tsx b/apps/erp/app/root.tsxindex 5ac527ed43..78d400005b 100644--- a/apps/erp/app/root.tsx+++ b/apps/erp/app/root.tsx@@ -68,6 +68,7 @@ export async function loader({ request, context }: LoaderFunctionArgs) {JIRA_CLIENT_ID,MES_URL,NOVU_APPLICATION_ID,+ NOVU_API_URL,ONSHAPE_CLIENT_ID,POSTHOG_API_HOST,POSTHOG_PROJECT_PUBLIC_KEY,@@ -93,6 +94,7 @@ export async function loader({ request, context }: LoaderFunctionArgs) {JIRA_CLIENT_ID,MES_URL,NOVU_APPLICATION_ID,+ NOVU_API_URL,ONSHAPE_CLIENT_ID,POSTHOG_API_HOST,POSTHOG_PROJECT_PUBLIC_KEY,diff --git a/ci/src/deploy.ts b/ci/src/deploy.tsindex f6b2866538..3b70c976e9 100644--- a/ci/src/deploy.ts+++ b/ci/src/deploy.ts@@ -37,7 +37,9 @@ export type Workspace = {cloudflare_turnstile_site_key: string | null;controlled_environment: string | null;exchange_rates_api_key: string | null;+ google_places_api_key: string | null;novu_application_id: string | null;+ novu_api_url: string | null;novu_secret_key: string | null;openai_api_key: string | null;posthog_api_host: string | null;@@ -115,7 +117,9 @@ async function deploy(): Promise<void> {cloudflare_turnstile_site_key,controlled_environment,exchange_rates_api_key,+ google_places_api_key,novu_application_id,+ novu_api_url,novu_secret_key,openai_api_key,posthog_api_host,@@ -271,7 +275,9 @@ async function deploy(): Promise<void> {CONTROLLED_ENVIRONMENT: controlled_environment ?? undefined,DOMAIN: domain_name,EXCHANGE_RATES_API_KEY: exchange_rates_api_key ?? undefined,+ GOOGLE_PLACES_API_KEY: google_places_api_key ?? undefined,NOVU_APPLICATION_ID: novu_application_id ?? undefined,+ NOVU_API_URL: novu_api_url ?? undefined,NOVU_SECRET_KEY: novu_secret_key ?? undefined,OPENAI_API_KEY: openai_api_key,POSTHOG_API_HOST: posthog_api_host ?? undefined,diff --git a/packages/auth/src/config/env.ts b/packages/auth/src/config/env.tsindex e9ca2a2031..58fe0eaf1d 100644--- a/packages/auth/src/config/env.ts+++ b/packages/auth/src/config/env.ts@@ -11,6 +11,8 @@ declare global {ERP_URL: string;JIRA_CLIENT_ID: string;MES_URL: string;+ NOVU_APPLICATION_ID: string;+ NOVU_API_URL: string;ONSHAPE_CLIENT_ID: string;POSTHOG_API_HOST: string;POSTHOG_PROJECT_PUBLIC_KEY: string;@@ -38,6 +40,8 @@ declare global {JIRA_OAUTH_REDIRECT_URL: string;JIRA_STATE_SECRET: string;MES_URL: string;+ NOVU_APPLICATION_ID: string;+ NOVU_API_URL: string;NOVU_SECRET_KEY: string;ONSHAPE_CLIENT_ID: string;ONSHAPE_CLIENT_SECRET: string;@@ -171,6 +175,12 @@ export const NOVU_APPLICATION_ID = getEnv("NOVU_APPLICATION_ID", {isRequired: false,isSecret: false});+export const NOVU_API_URL =+ getEnv("NOVU_API_URL", {+ isRequired: false,+ isSecret: false+ }) ?? "https://api.novu.co";+export const NOVU_SECRET_KEY = getEnv("NOVU_SECRET_KEY", {isRequired: false,isSecret: true@@ -371,6 +381,7 @@ export function getBrowserEnv() {MES_URL,NODE_ENV,NOVU_APPLICATION_ID,+ NOVU_API_URL,ONSHAPE_CLIENT_ID,POSTHOG_API_HOST,POSTHOG_PROJECT_PUBLIC_KEY,@@ -384,5 +395,5 @@ export function getBrowserEnv() {}export function isVercel() {- return VERCEL_URL.includes("vercel.app");+ return VERCEL_URL?.includes("vercel.app") ?? false;}diff --git a/packages/jobs/trigger/cleanup.ts b/packages/jobs/trigger/cleanup.tsindex 075eefc37e..aefd56db37 100644--- a/packages/jobs/trigger/cleanup.ts+++ b/packages/jobs/trigger/cleanup.ts@@ -1,4 +1,4 @@-import { getCarbonServiceRole, NOVU_SECRET_KEY } from "@carbon/auth";+import { getCarbonServiceRole, NOVU_API_URL, NOVU_SECRET_KEY } from "@carbon/auth";import type { TriggerPayload } from "@carbon/notifications";import {getSubscriberId,@@ -10,7 +10,9 @@ import { Novu } from "@novu/node";import { schedules } from "@trigger.dev/sdk";const serviceRole = getCarbonServiceRole();-const novu = new Novu(NOVU_SECRET_KEY!);+const novu = new Novu(NOVU_SECRET_KEY!, {+ backendUrl: NOVU_API_URL,+});export const cleanup = schedules.task({id: "cleanup",diff --git a/packages/jobs/trigger/notify.ts b/packages/jobs/trigger/notify.tsindex 64c14fabfd..0a94a32f86 100644--- a/packages/jobs/trigger/notify.ts+++ b/packages/jobs/trigger/notify.ts@@ -3,6 +3,7 @@ import {ERP_URL,NOVU_SECRET_KEY,VERCEL_URL,+NOVU_API_URL,} from "@carbon/auth";import type { Database } from "@carbon/database";import { notifyTaskAssigned } from "@carbon/ee/notifications";@@ -20,7 +21,9 @@ import { task } from "@trigger.dev/sdk";type ApprovalDocumentType =Database["public"]["Enums"]["approvalDocumentType"];-const novu = new Novu(NOVU_SECRET_KEY!);+const novu = new Novu(NOVU_SECRET_KEY!, {+ backendUrl: NOVU_API_URL,+});const isLocal = VERCEL_URL === undefined || VERCEL_URL.includes("localhost");// Helper function to get company integrationsdiff --git a/sst.config.ts b/sst.config.tsindex 5986f9a58a..771609c2fe 100644--- a/sst.config.ts+++ b/sst.config.ts@@ -55,6 +55,7 @@ export default $config({MES_URL: process.env.URL_MES ? `https://${process.env.URL_MES}` : "https://mes.itar.carbon.ms",NODE_ENV: "production",NOVU_APPLICATION_ID: process.env.NOVU_APPLICATION_ID,+ NOVU_API_URL: process.env.NOVU_API_URL,NOVU_SECRET_KEY: process.env.NOVU_SECRET_KEY,OPENAI_API_KEY: process.env.OPENAI_API_KEY,ONSHAPE_CLIENT_ID: process.env.ONSHAPE_CLIENT_ID,@@ -147,6 +148,7 @@ export default $config({MES_URL: process.env.URL_MES ? `https://${process.env.URL_MES}` : "https://mes.itar.carbon.ms",NODE_ENV: "production",NOVU_APPLICATION_ID: process.env.NOVU_APPLICATION_ID,+ NOVU_API_URL: process.env.NOVU_API_URL,NOVU_SECRET_KEY: process.env.NOVU_SECRET_KEY,OPENAI_API_KEY: process.env.OPENAI_API_KEY,ONSHAPE_CLIENT_ID: process.env.ONSHAPE_CLIENT_ID,