From 780509acd5f30a23234d47852b146b850f4f0942 Mon Sep 17 00:00:00 2001 From: shanice-skylight <150187231+shanice-skylight@users.noreply.github.com> Date: Wed, 8 Jan 2025 17:30:27 -0500 Subject: [PATCH] Modify application url to root (#250) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/workflows/ci.yaml | 2 +- .github/workflows/ecs_terraform.yaml | 7 ++++- .../design-review/design-review.sh | 4 +-- query-connector/next.config.js | 11 ++------ query-connector/playwright-setup.ts | 3 +-- query-connector/src/app/middleware.js | 26 ------------------- query-connector/src/app/page.tsx | 2 +- .../app/query/components/footer/footer.tsx | 2 +- .../app/query/components/header/header.tsx | 2 +- query-connector/src/app/signin/page.tsx | 2 +- 10 files changed, 16 insertions(+), 45 deletions(-) delete mode 100644 query-connector/src/app/middleware.js diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 527d3ac54..dcfcac157 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -87,7 +87,7 @@ jobs: run: docker compose -f ./docker-compose-e2e.yaml up -d - name: Poll until Query Connector is ready run: | - until curl -s http://localhost:3000/query-connector; do + until curl -s http://localhost:3000/; do echo "Waiting for Query Connector to be ready before running Playwright..." sleep 5 done diff --git a/.github/workflows/ecs_terraform.yaml b/.github/workflows/ecs_terraform.yaml index 860d405ce..df60ab9b7 100644 --- a/.github/workflows/ecs_terraform.yaml +++ b/.github/workflows/ecs_terraform.yaml @@ -85,4 +85,9 @@ jobs: -var "ersd_api_key=${ERSD_API_KEY}" \ -var "qc_tls_key=${TLS_KEY}" \ -var "qc_tls_cert=${TLS_CERT}" - terraform apply -auto-approve -replace="module.ecs.dockerless_remote_image.dibbs" + terraform apply -auto-approve -replace="module.ecs.dockerless_remote_image.dibbs[\"query-connector\"]" \ + -var-file="$WORKSPACE.tfvars" \ + -var "umls_api_key=${UMLS_API_KEY}" \ + -var "ersd_api_key=${ERSD_API_KEY}" \ + -var "qc_tls_key=${TLS_KEY}" \ + -var "qc_tls_cert=${TLS_CERT}" diff --git a/query-connector/design-review/design-review.sh b/query-connector/design-review/design-review.sh index 01398cf17..07cf37900 100755 --- a/query-connector/design-review/design-review.sh +++ b/query-connector/design-review/design-review.sh @@ -65,7 +65,7 @@ git checkout $BRANCH_NAME docker-compose build --no-cache && docker-compose up -d # Wait for TEFCA Viewer to be available -URL="http://localhost:3000/query-connector" +URL="http://localhost:3000/" while ! curl -s -o /dev/null -w "%{http_code}" "$URL" | grep -q "200"; do echo "Waiting for $URL to be available..." sleep 5 @@ -73,7 +73,7 @@ done # Open in default browser -open http://localhost:3000/query-connector +open http://localhost:3000/ # Prompt to end review session read -p "Press enter to end review" diff --git a/query-connector/next.config.js b/query-connector/next.config.js index 969225488..f48d04d33 100644 --- a/query-connector/next.config.js +++ b/query-connector/next.config.js @@ -8,16 +8,9 @@ const nextConfig = { ], }, transpilePackages: ["yaml"], - async rewrites() { - return [ - { - source: "/query-connector/:slug*", - destination: "/:slug*", - }, - ]; - }, + output: "standalone", - basePath: process.env.NODE_ENV === "production" ? "/query-connector" : "", + basePath: "", }; module.exports = nextConfig; diff --git a/query-connector/playwright-setup.ts b/query-connector/playwright-setup.ts index abd92717b..d102c6434 100644 --- a/query-connector/playwright-setup.ts +++ b/query-connector/playwright-setup.ts @@ -1,5 +1,4 @@ -export const TEST_URL = - process.env.TEST_ENV ?? "http://localhost:3000/query-connector"; +export const TEST_URL = process.env.TEST_ENV ?? "http://localhost:3000/"; /** * */ diff --git a/query-connector/src/app/middleware.js b/query-connector/src/app/middleware.js deleted file mode 100644 index 739a2e297..000000000 --- a/query-connector/src/app/middleware.js +++ /dev/null @@ -1,26 +0,0 @@ -// src/middleware.js -import { NextResponse } from "next/server"; - -/** - * Middleware function to handle URL redirection. - * @param request - The incoming request object. - * @returns The response after processing the middleware. - */ -export function middleware(request) { - const url = request.nextUrl.clone(); - - // Redirect only if the path is exactly '/' or empty - if (url.pathname === "/" || url.pathname === "") { - url.pathname = "/query-connector"; - return NextResponse.redirect(url); - } - - // Prevent any further redirects if the path already includes '/query-connector' - if (url.pathname === "/query-connector") { - return NextResponse.next(); - } - - return NextResponse.next(); -} - -export { auth as middleware } from "@/auth"; diff --git a/query-connector/src/app/page.tsx b/query-connector/src/app/page.tsx index 38a02f08d..5eb6b1f35 100644 --- a/query-connector/src/app/page.tsx +++ b/query-connector/src/app/page.tsx @@ -33,7 +33,7 @@ export default function LandingPage() { Graphic illustrating what TEFCA is
CDC logo diff --git a/query-connector/src/app/signin/page.tsx b/query-connector/src/app/signin/page.tsx index 63aeb13a4..2498bca4e 100644 --- a/query-connector/src/app/signin/page.tsx +++ b/query-connector/src/app/signin/page.tsx @@ -59,7 +59,7 @@ export default function SigninPage() {