diff --git a/.env.defaults b/.env.defaults index 5f93c8a..7a82883 100644 --- a/.env.defaults +++ b/.env.defaults @@ -15,8 +15,8 @@ PRISMA_HIDE_UPDATE_MESSAGE=true # Ordered by how verbose they are: trace | debug | info | warn | error | silent # LOG_LEVEL=debug -FIRST_NAME=Ahmed -LAST_NAME=Al-Taiar +FIRST_NAME=firstname +LAST_NAME=lastname GMAIL=example@gmail.com GMAIL_SMTP_PASSWORD=chan geme xyza bcde diff --git a/api/src/functions/graphql.ts b/api/src/functions/graphql.ts index c5e182b..2ccdb72 100644 --- a/api/src/functions/graphql.ts +++ b/api/src/functions/graphql.ts @@ -5,6 +5,7 @@ import { HexColorCodeResolver, } from 'graphql-scalars' +import { isProduction } from '@redwoodjs/api/logger' import { createAuthDecoder } from '@redwoodjs/auth-dbauth-api' import { createGraphQLHandler } from '@redwoodjs/graphql-server' @@ -32,5 +33,11 @@ export const handler = createGraphQLHandler({ HexColorCode: HexColorCodeResolver, }, }, + cors: { + origin: isProduction + ? [process.env.ADDRESS_PROD, process.env.API_ADDRESS_PROD] + : [process.env.ADDRESS_DEV, process.env.API_ADDRESS_DEV], + credentials: isProduction ? true : false, + }, onException: () => db.$disconnect(), })