Skip to content

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.

fix: add environment variable for auth providers

Brad Barbin08091c7b7629
diff --git a/.env.example b/.env.example
index ad18f4b652..1d5c5ad56d 100644
--- a/.env.example
+++ b/.env.example
@@ -1,10 +1,11 @@
-DOMAIN="localhost:3000"
-
+AUTH_PROVIDERS="email,google,azure"
CARBON_EDITION="community" # "community" | "cloud" | "enterprise"
CLOUDFLARE_TURNSTILE_SITE_KEY="1x00000000000000000000AA"
CLOUDFLARE_TURNSTILE_SECRET_KEY="********************"
+DOMAIN="localhost:3000"
+
NOVU_APPLICATION_ID="********************"
NOVU_SECRET_KEY="********************"
diff --git a/apps/erp/app/routes/_public+/login.tsx b/apps/erp/app/routes/_public+/login.tsx
index 5ee87ba358..92e0570a75 100644
--- a/apps/erp/app/routes/_public+/login.tsx
+++ b/apps/erp/app/routes/_public+/login.tsx
@@ -1,4 +1,5 @@
import {
+ AUTH_PROVIDERS,
assertIsPost,
CarbonEdition,
CLOUDFLARE_TURNSTILE_SECRET_KEY,
@@ -7,9 +8,7 @@ import {
carbonClient,
error,
magicLinkValidator,
- RATE_LIMIT,
- SUPABASE_AUTH_EXTERNAL_AZURE_CLIENT_ID,
- SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_ID
+ RATE_LIMIT
} from "@carbon/auth";
import { sendMagicLink, verifyAuthSession } from "@carbon/auth/auth.server";
import { flash, getAuthSession } from "@carbon/auth/session.server";
@@ -44,7 +43,6 @@ import {
useLoaderData,
useSearchParams
} from "react-router";
-
import type { Result } from "~/types";
import { path } from "~/utils/path";
@@ -58,9 +56,10 @@ export async function loader({ request }: LoaderFunctionArgs) {
throw redirect(path.to.authenticatedRoot);
}
+ const providers = AUTH_PROVIDERS.split(",");
+
return {
- hasOutlookAuth: !!SUPABASE_AUTH_EXTERNAL_AZURE_CLIENT_ID,
- hasGoogleAuth: !!SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_ID
+ providers
};
}
@@ -156,7 +155,10 @@ export async function action({ request }: ActionFunctionArgs) {
}
export default function LoginRoute() {
- const { hasOutlookAuth, hasGoogleAuth } = useLoaderData<typeof loader>();
+ const { providers } = useLoaderData<typeof loader>();
+ const hasOutlookAuth = providers.includes("azure");
+ const hasGoogleAuth = providers.includes("google");
+
const [searchParams] = useSearchParams();
const redirectTo = searchParams.get("redirectTo") ?? undefined;
const [mode, setMode] = useState<"login" | "signup" | "verify">("login");
diff --git a/apps/erp/app/routes/_public+/verify.tsx b/apps/erp/app/routes/_public+/verify.tsx
index 881aaa8c6b..5397e2326a 100644
--- a/apps/erp/app/routes/_public+/verify.tsx
+++ b/apps/erp/app/routes/_public+/verify.tsx
@@ -36,7 +36,7 @@ import {
} from "react-router";
import { z } from "zod";
-import type { FormActionData, Result } from "~/types";
+import type { Result } from "~/types";
import { path } from "~/utils/path";
export const meta: MetaFunction = () => {
@@ -64,7 +64,7 @@ const ratelimit = new Ratelimit({
analytics: true
});
-export async function action({ request }: ActionFunctionArgs): FormActionData {
+export async function action({ request }: ActionFunctionArgs) {
assertIsPost(request);
const ip = request.headers.get("x-forwarded-for") ?? "127.0.0.1";
diff --git a/apps/mes/app/routes/_public+/login.tsx b/apps/mes/app/routes/_public+/login.tsx
index 9cbbeba3cd..4d32404d8c 100644
--- a/apps/mes/app/routes/_public+/login.tsx
+++ b/apps/mes/app/routes/_public+/login.tsx
@@ -1,13 +1,12 @@
import {
+ AUTH_PROVIDERS,
assertIsPost,
CarbonEdition,
CONTROLLED_ENVIRONMENT,
carbonClient,
error,
magicLinkValidator,
- RATE_LIMIT,
- SUPABASE_AUTH_EXTERNAL_AZURE_CLIENT_ID,
- SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_ID
+ RATE_LIMIT
} from "@carbon/auth";
import { sendMagicLink, verifyAuthSession } from "@carbon/auth/auth.server";
import { flash, getAuthSession } from "@carbon/auth/session.server";
@@ -52,9 +51,10 @@ export async function loader({ request }: LoaderFunctionArgs) {
throw redirect(path.to.authenticatedRoot);
}
+ const providers = AUTH_PROVIDERS.split(",");
+
return {
- hasOutlookAuth: !!SUPABASE_AUTH_EXTERNAL_AZURE_CLIENT_ID,
- hasGoogleAuth: !!SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_ID
+ providers
};
}
@@ -107,7 +107,10 @@ export async function action({ request }: ActionFunctionArgs) {
}
export default function LoginRoute() {
- const { hasOutlookAuth, hasGoogleAuth } = useLoaderData<typeof loader>();
+ const { providers } = useLoaderData<typeof loader>();
+ const hasOutlookAuth = providers.includes("azure");
+ const hasGoogleAuth = providers.includes("google");
+
const [searchParams] = useSearchParams();
const redirectTo = searchParams.get("redirectTo") ?? undefined;
diff --git a/packages/auth/src/config/env.ts b/packages/auth/src/config/env.ts
index cda39b00a0..266bc3cc1f 100644
--- a/packages/auth/src/config/env.ts
+++ b/packages/auth/src/config/env.ts
@@ -3,6 +3,7 @@ import { Edition, isBrowser, parseBoolean } from "@carbon/utils";
declare global {
interface Window {
env: {
+ AUTH_PROVIDERS: string;
CARBON_EDITION: string;
CLOUDFLARE_TURNSTILE_SITE_KEY: string;
CONTROLLED_ENVIRONMENT: string;
@@ -86,6 +87,12 @@ export function getEnv(
* Server env
*/
+export const AUTH_PROVIDERS =
+ getEnv("AUTH_PROVIDERS", {
+ isRequired: false,
+ isSecret: false
+ }) ?? "email,google,azure";
+
const CARBON_EDITION = getEnv("CARBON_EDITION", {
isRequired: false,
isSecret: false
diff --git a/packages/database/src/swagger-docs-schema.ts b/packages/database/src/swagger-docs-schema.ts
index a58856ef12..edb170f99f 100644
--- a/packages/database/src/swagger-docs-schema.ts
+++ b/packages/database/src/swagger-docs-schema.ts
@@ -17802,6 +17802,9 @@ export default {
{
$ref: "#/parameters/rowFilter.jobMakeMethod.version",
},
+ {
+ $ref: "#/parameters/rowFilter.jobMakeMethod.itemScrapPercentage",
+ },
{
$ref: "#/parameters/select",
},
@@ -17906,6 +17909,9 @@ export default {
{
$ref: "#/parameters/rowFilter.jobMakeMethod.version",
},
+ {
+ $ref: "#/parameters/rowFilter.jobMakeMethod.itemScrapPercentage",
+ },
{
$ref: "#/parameters/preferReturn",
},
@@ -17964,6 +17970,9 @@ export default {
{
$ref: "#/parameters/rowFilter.jobMakeMethod.version",
},
+ {
+ $ref: "#/parameters/rowFilter.jobMakeMethod.itemScrapPercentage",
+ },
{
$ref: "#/parameters/body.jobMakeMethod",
},
@@ -28221,6 +28230,9 @@ export default {
{
$ref: "#/parameters/rowFilter.jobOperation.conflictReason",
},
+ {
+ $ref: "#/parameters/rowFilter.jobOperation.targetQuantity",
+ },
{
$ref: "#/parameters/select",
},
@@ -28406,6 +28418,9 @@ export default {
{
$ref: "#/parameters/rowFilter.jobOperation.conflictReason",
},
+ {
+ $ref: "#/parameters/rowFilter.jobOperation.targetQuantity",
+ },
{
$ref: "#/parameters/preferReturn",
},
@@ -28545,6 +28560,9 @@ export default {
{
$ref: "#/parameters/rowFilter.jobOperation.conflictReason",
},
+ {
+ $ref: "#/parameters/rowFilter.jobOperation.targetQuantity",
+ },
{
$ref: "#/parameters/body.jobOperation",
},
@@ -43884,6 +43902,9 @@ export default {
{
$ref: "#/parameters/rowFilter.jobMaterial.kit",
},
+ {
+ $ref: "#/parameters/rowFilter.jobMaterial.itemScrapPercentage",
+ },
{
$ref: "#/parameters/select",
},
@@ -44024,6 +44045,9 @@ export default {
{
$ref: "#/parameters/rowFilter.jobMaterial.kit",
},
+ {
+ $ref: "#/parameters/rowFilter.jobMaterial.itemScrapPercentage",
+ },
{
$ref: "#/parameters/preferReturn",
},
@@ -44118,6 +44142,9 @@ export default {
{
$ref: "#/parameters/rowFilter.jobMaterial.kit",
},
+ {
+ $ref: "#/parameters/rowFilter.jobMaterial.itemScrapPercentage",
+ },
{
$ref: "#/parameters/body.jobMaterial",
},
@@ -73384,6 +73411,7 @@ export default {
"requiresSerialTracking",
"requiresBatchTracking",
"version",
+ "itemScrapPercentage",
],
properties: {
id: {
@@ -73466,6 +73494,13 @@ export default {
format: "numeric",
type: "number",
},
+ itemScrapPercentage: {
+ default: 0,
+ description:
+ "Scrap percentage from itemReplenishment at time of job creation",
+ format: "numeric",
+ type: "number",
+ },
},
type: "object",
},
@@ -78210,6 +78245,13 @@ export default {
format: "text",
type: "string",
},
+ targetQuantity: {
+ default: 0,
+ description:
+ "The target quantity to produce before accounting for scrap (parent.estimatedQuantity * quantityPerParent)",
+ format: "numeric",
+ type: "number",
+ },
},
type: "object",
},
@@ -85550,6 +85592,7 @@ export default {
"requiresSerialTracking",
"requiresBatchTracking",
"kit",
+ "itemScrapPercentage",
],
properties: {
id: {
@@ -85691,6 +85734,13 @@ export default {
format: "boolean",
type: "boolean",
},
+ itemScrapPercentage: {
+ default: 0,
+ description:
+ "Scrap percentage from itemReplenishment at time of job creation",
+ format: "numeric",
+ type: "number",
+ },
},
type: "object",
},
@@ -103402,6 +103452,14 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.jobMakeMethod.itemScrapPercentage": {
+ name: "itemScrapPercentage",
+ description:
+ "Scrap percentage from itemReplenishment at time of job creation",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"body.salesRfqLine": {
name: "salesRfqLine",
description: "salesRfqLine",
@@ -108689,6 +108747,14 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.jobOperation.targetQuantity": {
+ name: "targetQuantity",
+ description:
+ "The target quantity to produce before accounting for scrap (parent.estimatedQuantity * quantityPerParent)",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"body.userAttributeCategory": {
name: "userAttributeCategory",
description: "userAttributeCategory",
@@ -117237,6 +117303,14 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.jobMaterial.itemScrapPercentage": {
+ name: "itemScrapPercentage",
+ description:
+ "Scrap percentage from itemReplenishment at time of job creation",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"body.supplierQuoteLinePrice": {
name: "supplierQuoteLinePrice",
description: "supplierQuoteLinePrice",
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 6526201313..a9070c56ea 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -31334,48 +31334,6 @@ export type Database = {
},
]
}
- searchIndex_7XFgHYBbyiscTuvDxncdhj: {
- Row: {
- createdAt: string
- description: string | null
- entityId: string
- entityType: string
- id: number
- link: string
- metadata: Json | null
- searchVector: unknown
- tags: string[] | null
- title: string
- updatedAt: string | null
- }
- Insert: {
- createdAt?: string
- description?: string | null
- entityId: string
- entityType: string
- id?: number
- link: string
- metadata?: Json | null
- searchVector?: unknown
- tags?: string[] | null
- title: string
- updatedAt?: string | null
- }
- Update: {
- createdAt?: string
- description?: string | null
- entityId?: string
- entityType?: string
- id?: number
- link?: string
- metadata?: Json | null
- searchVector?: unknown
- tags?: string[] | null
- title?: string
- updatedAt?: string | null
- }
- Relationships: []
- }
searchIndexRegistry: {
Row: {
companyId: string
@@ -53382,7 +53340,6 @@ export type Database = {
quantityScrapped: number
setupTime: number
setupUnit: Database["public"]["Enums"]["factor"]
- targetQuantity: number
workCenterId: string
}[]
}
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index 6526201313..a9070c56ea 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -31334,48 +31334,6 @@ export type Database = {
},
]
}
- searchIndex_7XFgHYBbyiscTuvDxncdhj: {
- Row: {
- createdAt: string
- description: string | null
- entityId: string
- entityType: string
- id: number
- link: string
- metadata: Json | null
- searchVector: unknown
- tags: string[] | null
- title: string
- updatedAt: string | null
- }
- Insert: {
- createdAt?: string
- description?: string | null
- entityId: string
- entityType: string
- id?: number
- link: string
- metadata?: Json | null
- searchVector?: unknown
- tags?: string[] | null
- title: string
- updatedAt?: string | null
- }
- Update: {
- createdAt?: string
- description?: string | null
- entityId?: string
- entityType?: string
- id?: number
- link?: string
- metadata?: Json | null
- searchVector?: unknown
- tags?: string[] | null
- title?: string
- updatedAt?: string | null
- }
- Relationships: []
- }
searchIndexRegistry: {
Row: {
companyId: string
@@ -53382,7 +53340,6 @@ export type Database = {
quantityScrapped: number
setupTime: number
setupUnit: Database["public"]["Enums"]["factor"]
- targetQuantity: number
workCenterId: string
}[]
}