Cleanup live changes

This commit is contained in:
Darren Clarke 2023-06-05 15:00:46 +00:00 committed by GitHub
parent d0f9e8bb65
commit 6a85c644dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 20 deletions

View file

@ -11,15 +11,11 @@ import { useAppContext } from "./AppProvider";
export const Layout: FC<PropsWithChildren> = ({ children }) => {
const [cookies, setCookie] = useCookies(["cookieConsent"]);
const consentGranted = cookies.cookieConsent === "true";
/*
const {
publicRuntimeConfig: { embedded },
} = getConfig();
*/
const embedded = true;
const {
colors: {
white,

View file

@ -18,7 +18,6 @@ COPY --from=builder ${APP_DIR}/out/package-lock.json ./package-lock.json
RUN npm ci --omit=dev
COPY --from=builder ${APP_DIR}/out/full/ .
ARG LINK_URL=https://link-stack-dev.digiresilience.org
RUN npm i -g turbo
RUN turbo run build --filter=link

View file

@ -3,6 +3,10 @@ import type { NextRequest } from 'next/server';
import { withAuth, NextRequestWithAuth } from "next-auth/middleware";
const rewriteURL = (request: NextRequest, originBaseURL: string, destinationBaseURL: string, headers: any = {}) => {
if (request.nextUrl.protocol.startsWith('ws')) {
return NextResponse.next();
}
if (request.nextUrl.pathname.includes('/_next/static/development/')) {
return NextResponse.next();
}
@ -26,12 +30,15 @@ console.log({finalHeaders: requestHeaders});
const checkRewrites = async (request: NextRequestWithAuth) => {
console.log({ currentURL: request.nextUrl.href });
const linkBaseURL = "http://localhost:3000";
const zammadURL = "http://zammad-nginx:8080";
const linkBaseURL = process.env.LINK_URL ?? "http://localhost:3000";
const zammadURL = process.env.ZAMMAD_URL ?? "http://zammad-nginx:8080";
const leafcutterURL = process.env.LEAFCUTTER_URL ?? "http://leafcutter:3000";
const metamigoURL = process.env.METAMIGO_URL ?? "http://metamigo:3000";
if (request.nextUrl.pathname.startsWith('/proxy/leafcutter')) {
return rewriteURL(request, linkBaseURL, "http://leafcutter:3000");
return rewriteURL(request, linkBaseURL, leafcutterURL);
} else if (request.nextUrl.pathname.startsWith('/proxy/metamigo')) {
return rewriteURL(request, linkBaseURL, "http://metamigo:3000");
return rewriteURL(request, linkBaseURL, metamigoURL);
} else if (request.nextUrl.pathname.startsWith('/proxy/zammad')) {
console.log('proxying to zammad');
const { token } = request.nextauth;