From a83f32312ae33876de605bb551f9ff3dc2681423 Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Thu, 8 Aug 2024 14:14:53 +0100
Subject: [PATCH 01/11] ar(fix) [DPTM-2]: Ensure autonomous Dev environment
---
.env.public | 4 +++-
README.md | 3 ++-
lib/auth/constants.ts | 6 +++---
next.config.js | 2 +-
src/app/components/client/elements/link-decorator.tsx | 2 +-
src/middleware.ts | 2 +-
6 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/.env.public b/.env.public
index 35595232..16c37935 100644
--- a/.env.public
+++ b/.env.public
@@ -10,6 +10,8 @@
# env specific
API_HOST_DEV=
API_HOST=http://localhost:3001
+NEXUS_HOST=http://localhost:3000
+MAIN_URL=http://localhost:2999
# context specific
GITHUB_ID=
@@ -48,7 +50,7 @@ MONGODB_DEFAULT_ORG=yourorg
# @@@ WARNING: THESE APPEAR IN THE BROWSER OF EVERY VISITOR @@@
# base path: client (browser)
-NEXT_PUBLIC_NEXUS_HOST=
+NEXT_PUBLIC_MAIN_URL=http://localhost:2999
NEXT_PUBLIC_NEXUS_BASE_PATH=
NEXT_PUBLIC_NEXUS_NAME=Nexus
NEXT_PUBLIC_NEXUS_LOGO_PATH=
diff --git a/README.md b/README.md
index 869398a5..e8d3e2b8 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,8 @@ npm run dev
Documentation: TBD
-Staging Environment: https://alpha.dreampip.com
+Dev Environment: https://dev.nyx.dreampip.com
+Prod Environment: https://nyx.dreampip.com
License: HPL3-ECO-AND-ANC 2021—Present
diff --git a/lib/auth/constants.ts b/lib/auth/constants.ts
index 6c4ff121..5f5fe18a 100644
--- a/lib/auth/constants.ts
+++ b/lib/auth/constants.ts
@@ -11,7 +11,7 @@ const methods = {
signIn: () => {},
signOut: async () => {
try {
- const response = await fetch(`${process.env.NEXT_PUBLIC_NEXUS_HOST}/api/v1/auth/signout`, {
+ const response = await fetch(`${process.env.NEXT_PUBLIC_MAIN_URL}/api/v1/auth/signout`, {
method: 'POST',
headers: {
Accept: 'application/json',
@@ -26,7 +26,7 @@ const methods = {
},
getCsrf: async () => {
try {
- const response = await fetch(`${process.env.NEXT_PUBLIC_NEXUS_HOST}/api/v1/auth/csrf`, {
+ const response = await fetch(`${process.env.NEXT_PUBLIC_MAIN_URL}/api/v1/auth/csrf`, {
method: 'GET',
headers: {
Accept: 'application/json',
@@ -41,7 +41,7 @@ const methods = {
},
getSession: async (params = { cookies: '' }) => {
try {
- const response = await fetch(`${process.env.NEXT_PUBLIC_NEXUS_HOST}/api/v1/auth/session`, {
+ const response = await fetch(`${process.env.NEXT_PUBLIC_MAIN_URL}/api/v1/auth/session`, {
method: 'GET',
headers: {
Accept: 'application/json',
diff --git a/next.config.js b/next.config.js
index 212f38ae..832de795 100644
--- a/next.config.js
+++ b/next.config.js
@@ -1,7 +1,7 @@
/** @type {import('next').NextConfig} */
const { withSentryConfig } = require('@sentry/nextjs');
const nextConfig = {
- assetPrefix: process.env.MAIN_URL || 'https://nyx.dreampip.com',
+ assetPrefix: process.env.NEXUS_HOST || 'https://nyx.dreampip.com',
transpilePackages: ['next-auth'],
images: {
remotePatterns: [
diff --git a/src/app/components/client/elements/link-decorator.tsx b/src/app/components/client/elements/link-decorator.tsx
index 95d9e7c8..04bac103 100644
--- a/src/app/components/client/elements/link-decorator.tsx
+++ b/src/app/components/client/elements/link-decorator.tsx
@@ -4,6 +4,6 @@ import { Link as DPLink } from "@dreampipcom/oneiros"
export const DPLinkDec = (props: any) => {
return (
-
+
);
};
diff --git a/src/middleware.ts b/src/middleware.ts
index 7ccf4cc5..08312868 100644
--- a/src/middleware.ts
+++ b/src/middleware.ts
@@ -7,7 +7,7 @@ export const config = {
};
const headers: Record = {
- 'Access-Control-Allow-Origin': process.env.MAIN_URL || 'https://www.dreampip.com',
+ 'Access-Control-Allow-Origin': process.env.NEXUS_HOST || 'https://www.dreampip.com',
'Cache-Control': 'maxage=0, s-maxage=300, stale-while-revalidate=300',
// DEV-DEBUG:
// 'content-type': 'application/json',
From 98a073b522b2063cc60f22eb843fa0c840612a5c Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Thu, 8 Aug 2024 14:22:30 +0100
Subject: [PATCH 02/11] ar(fix) [DPTM-2]: Ensure autonomous Dev environment
---
src/middleware.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/middleware.ts b/src/middleware.ts
index 08312868..7ccf4cc5 100644
--- a/src/middleware.ts
+++ b/src/middleware.ts
@@ -7,7 +7,7 @@ export const config = {
};
const headers: Record = {
- 'Access-Control-Allow-Origin': process.env.NEXUS_HOST || 'https://www.dreampip.com',
+ 'Access-Control-Allow-Origin': process.env.MAIN_URL || 'https://www.dreampip.com',
'Cache-Control': 'maxage=0, s-maxage=300, stale-while-revalidate=300',
// DEV-DEBUG:
// 'content-type': 'application/json',
From 8a09f70c1a779791adbfd0506f608689336be173 Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Thu, 8 Aug 2024 15:18:52 +0100
Subject: [PATCH 03/11] ar(fix) [DPTM-2]: Ensure autonomous Dev environment
---
src/middleware.ts | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/middleware.ts b/src/middleware.ts
index 7ccf4cc5..ae11414a 100644
--- a/src/middleware.ts
+++ b/src/middleware.ts
@@ -6,6 +6,13 @@ export const config = {
matcher: ['/api/:path*'],
};
+const allowedOrigins = {
+ [process.env.MAIN_URL]: process.env.MAIN_URL,
+ [process.env.NEXUS_HOST]: process.env.NEXUS_HOST,
+ [process.env.API_HOST]: process.env.API_HOST,
+}
+
+
const headers: Record = {
'Access-Control-Allow-Origin': process.env.MAIN_URL || 'https://www.dreampip.com',
'Cache-Control': 'maxage=0, s-maxage=300, stale-while-revalidate=300',
@@ -17,6 +24,11 @@ const headers: Record = {
};
export function middleware(request: NextRequest) {
+ const origin = request.headers.get('x-forwarded-host')
+ if(origin !== process.env.MAIN_URL) {
+ headers['Access-Control-Allow-Origin'] = allowedOrigins[origin] || 'https://www.dreampip.com'
+ }
+
const response = NextResponse.next();
const pkce = request.cookies.get('next-auth.pkce.code_verifier');
From c84dcb750bc2884433267090f74a962bca07c8f8 Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Thu, 8 Aug 2024 15:21:28 +0100
Subject: [PATCH 04/11] ar(fix) [DPTM-2]: Ensure autonomous Dev environment
---
src/middleware.ts | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/middleware.ts b/src/middleware.ts
index ae11414a..9bb12969 100644
--- a/src/middleware.ts
+++ b/src/middleware.ts
@@ -7,9 +7,9 @@ export const config = {
};
const allowedOrigins = {
- [process.env.MAIN_URL]: process.env.MAIN_URL,
- [process.env.NEXUS_HOST]: process.env.NEXUS_HOST,
- [process.env.API_HOST]: process.env.API_HOST,
+ [`${process.env.MAIN_URL}`]: process.env.MAIN_URL,
+ [`${process.env.NEXUS_HOST}`]: process.env.NEXUS_HOST,
+ [`${process.env.API_HOST}`]: process.env.API_HOST,
}
From b36516a4b6fa5b922eef8995c67d957a15b7aab3 Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Thu, 8 Aug 2024 15:22:53 +0100
Subject: [PATCH 05/11] ar(fix) [DPTM-2]: Ensure autonomous Dev environment
---
src/middleware.ts | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/middleware.ts b/src/middleware.ts
index 9bb12969..22580a02 100644
--- a/src/middleware.ts
+++ b/src/middleware.ts
@@ -10,8 +10,7 @@ const allowedOrigins = {
[`${process.env.MAIN_URL}`]: process.env.MAIN_URL,
[`${process.env.NEXUS_HOST}`]: process.env.NEXUS_HOST,
[`${process.env.API_HOST}`]: process.env.API_HOST,
-}
-
+};
const headers: Record = {
'Access-Control-Allow-Origin': process.env.MAIN_URL || 'https://www.dreampip.com',
@@ -24,9 +23,9 @@ const headers: Record = {
};
export function middleware(request: NextRequest) {
- const origin = request.headers.get('x-forwarded-host')
- if(origin !== process.env.MAIN_URL) {
- headers['Access-Control-Allow-Origin'] = allowedOrigins[origin] || 'https://www.dreampip.com'
+ const origin = request.headers.get('x-forwarded-host');
+ if (origin !== process.env.MAIN_URL) {
+ headers['Access-Control-Allow-Origin'] = allowedOrigins[origin] || 'https://www.dreampip.com';
}
const response = NextResponse.next();
From 5e76faa8980f8f64cb68a64303fdad24b16ffffa Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Thu, 8 Aug 2024 15:25:07 +0100
Subject: [PATCH 06/11] ar(fix) [DPTM-2]: Ensure autonomous Dev environment
---
src/middleware.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/middleware.ts b/src/middleware.ts
index 22580a02..888c0603 100644
--- a/src/middleware.ts
+++ b/src/middleware.ts
@@ -23,7 +23,7 @@ const headers: Record = {
};
export function middleware(request: NextRequest) {
- const origin = request.headers.get('x-forwarded-host');
+ const origin = request.headers.get('x-forwarded-host') || process.env.MAIN_URL;
if (origin !== process.env.MAIN_URL) {
headers['Access-Control-Allow-Origin'] = allowedOrigins[origin] || 'https://www.dreampip.com';
}
From ab4499c90514b77ec954ed4e77ca6d81fc3d02d1 Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Thu, 8 Aug 2024 15:25:28 +0100
Subject: [PATCH 07/11] ar(fix) [DPTM-2]: Ensure autonomous Dev environment
---
src/middleware.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/middleware.ts b/src/middleware.ts
index 888c0603..3010a854 100644
--- a/src/middleware.ts
+++ b/src/middleware.ts
@@ -23,7 +23,7 @@ const headers: Record = {
};
export function middleware(request: NextRequest) {
- const origin = request.headers.get('x-forwarded-host') || process.env.MAIN_URL;
+ const origin = request.headers.get('x-forwarded-host') || "";
if (origin !== process.env.MAIN_URL) {
headers['Access-Control-Allow-Origin'] = allowedOrigins[origin] || 'https://www.dreampip.com';
}
From 647cfcadc98efdaea8cfabd8e3abff499a445c7c Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Thu, 8 Aug 2024 15:28:12 +0100
Subject: [PATCH 08/11] ar(fix) [DPTM-2]: Ensure autonomous Dev environment
---
src/middleware.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/middleware.ts b/src/middleware.ts
index 3010a854..532acf15 100644
--- a/src/middleware.ts
+++ b/src/middleware.ts
@@ -23,7 +23,7 @@ const headers: Record = {
};
export function middleware(request: NextRequest) {
- const origin = request.headers.get('x-forwarded-host') || "";
+ const origin = request.headers.get('x-forwarded-host') || '';
if (origin !== process.env.MAIN_URL) {
headers['Access-Control-Allow-Origin'] = allowedOrigins[origin] || 'https://www.dreampip.com';
}
From 995d6f3e19deb0651456982a78800e8f46b257da Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Thu, 8 Aug 2024 15:36:14 +0100
Subject: [PATCH 09/11] ar(fix) [DPTM-2]: Ensure autonomous Dev environment
---
next.config.js | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/next.config.js b/next.config.js
index 832de795..aaaf08f3 100644
--- a/next.config.js
+++ b/next.config.js
@@ -11,6 +11,15 @@ const nextConfig = {
},
],
},
+ experimental: {
+ serverActions: {
+ allowedOrigins: [
+ process.env.NEXUS_HOST,
+ process.env.MAIN_URL,
+ process.env.API_HOST,
+ ]
+ }
+ }
async redirects() {
return [
{
From 9cf79a4884bd9ea809b68d4e6eef1fd147f6d609 Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Thu, 8 Aug 2024 15:37:50 +0100
Subject: [PATCH 10/11] ar(fix) [DPTM-2]: Ensure autonomous Dev environment
---
next.config.js | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/next.config.js b/next.config.js
index aaaf08f3..ee6f81bf 100644
--- a/next.config.js
+++ b/next.config.js
@@ -12,14 +12,14 @@ const nextConfig = {
],
},
experimental: {
- serverActions: {
- allowedOrigins: [
- process.env.NEXUS_HOST,
- process.env.MAIN_URL,
- process.env.API_HOST,
- ]
- }
+ serverActions: {
+ allowedOrigins: [
+ process.env.NEXUS_HOST,
+ process.env.MAIN_URL,
+ process.env.API_HOST,
+ ]
}
+ },
async redirects() {
return [
{
From 22d551697128fe5084778cb96f3aa2b44f3e623c Mon Sep 17 00:00:00 2001
From: Angelo Reale <12191809+angeloreale@users.noreply.github.com>
Date: Thu, 8 Aug 2024 15:39:06 +0100
Subject: [PATCH 11/11] ar(fix) [DPTM-2]: Ensure autonomous Dev environment
---
next.config.js | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/next.config.js b/next.config.js
index ee6f81bf..c11205c5 100644
--- a/next.config.js
+++ b/next.config.js
@@ -13,12 +13,8 @@ const nextConfig = {
},
experimental: {
serverActions: {
- allowedOrigins: [
- process.env.NEXUS_HOST,
- process.env.MAIN_URL,
- process.env.API_HOST,
- ]
- }
+ allowedOrigins: [process.env.NEXUS_HOST, process.env.MAIN_URL, process.env.API_HOST],
+ },
},
async redirects() {
return [