diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9402b13024..96e8c018b6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -31,6 +31,8 @@ jobs: env: NEXT_PUBLIC_QUESTION_SERVICE_URL: ${{ secrets.NEXT_PUBLIC_QUESTION_SERVICE_URL }} NEXT_PUBLIC_AUTH_SERVICE_URL: ${{ secrets.NEXT_PUBLIC_AUTH_SERVICE_URL }} + AUTH_SERVICE_URL: ${{ secrets.AUTH_SERVICE_URL }} + QUESTION_SERVICE_URL: ${{ secrets.QUESTION_SERVICE_URL }} run: | gcloud builds submit --config cloudbuild.yaml \ --substitutions _NEXT_PUBLIC_QUESTION_SERVICE_URL=$NEXT_PUBLIC_QUESTION_SERVICE_URL,_NEXT_PUBLIC_AUTH_SERVICE_URL=$NEXT_PUBLIC_AUTH_SERVICE_URL diff --git a/cloudbuild.yaml b/cloudbuild.yaml index d702f06cf5..7fc2e31c50 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -12,6 +12,10 @@ steps: "NEXT_PUBLIC_QUESTION_SERVICE_URL=${_NEXT_PUBLIC_QUESTION_SERVICE_URL}", "--build-arg", "NEXT_PUBLIC_AUTH_SERVICE_URL=${_NEXT_PUBLIC_AUTH_SERVICE_URL}", + "--build-arg", + "AUTH_SERVICE_URL=${_AUTH_SERVICE_URL}", + "--build-arg", + "QUESTION_SERVICE_URL=${_QUESTION_SERVICE_URL}", "-f", "peerprep-fe/Dockerfile", "peerprep-fe", diff --git a/k8s/peerprep-config.yml b/k8s/peerprep-config.yml index 98f4c8c428..ae1f6620c8 100644 --- a/k8s/peerprep-config.yml +++ b/k8s/peerprep-config.yml @@ -6,3 +6,5 @@ type: Opaque stringData: NEXT_PUBLIC_QUESTION_SERVICE_URL: "${_NEXT_PUBLIC_QUESTION_SERVICE_URL}" NEXT_PUBLIC_AUTH_SERVICE_URL: "${_NEXT_PUBLIC_AUTH_SERVICE_URL}" + AUTH_SERVICE_URL: "${_AUTH_SERVICE_URL}" + QUESTION_SERVICE_URL: "${_QUESTION_SERVICE_URL}" diff --git a/peerprep-fe/Dockerfile b/peerprep-fe/Dockerfile index 1f6ffd5808..f5d8efa1d6 100644 --- a/peerprep-fe/Dockerfile +++ b/peerprep-fe/Dockerfile @@ -33,10 +33,14 @@ ENV PORT=3000 # Accept build arguments ARG NEXT_PUBLIC_QUESTION_SERVICE_URL ARG NEXT_PUBLIC_AUTH_SERVICE_URL +ARG AUTH_SERVICE_URL +ARG QUESTION_SERVICE_URL # Set environment variables ENV NEXT_PUBLIC_QUESTION_SERVICE_URL=$NEXT_PUBLIC_QUESTION_SERVICE_URL ENV NEXT_PUBLIC_AUTH_SERVICE_URL=$NEXT_PUBLIC_AUTH_SERVICE_URL +ENV AUTH_SERVICE_URL=$AUTH_SERVICE_URL +ENV QUESTION_SERVICE_URL=$QUESTION_SERVICE_URL COPY . . RUN pnpm build diff --git a/peerprep-fe/next.config.mjs b/peerprep-fe/next.config.mjs index 06532b679d..48655a5cda 100644 --- a/peerprep-fe/next.config.mjs +++ b/peerprep-fe/next.config.mjs @@ -5,6 +5,8 @@ const nextConfig = { NEXT_PUBLIC_QUESTION_SERVICE_URL: process.env.NEXT_PUBLIC_QUESTION_SERVICE_URL, NEXT_PUBLIC_AUTH_SERVICE_URL: process.env.NEXT_PUBLIC_AUTH_SERVICE_URL, + AUTH_SERVICE_URL: process.env.AUTH_SERVICE_URL, + QUESTION_SERVICE_URL: process.env.QUESTION_SERVICE_URL, }, }; diff --git a/peerprep-fe/src/middleware.ts b/peerprep-fe/src/middleware.ts index 2c9d53fba3..82ebcd0884 100644 --- a/peerprep-fe/src/middleware.ts +++ b/peerprep-fe/src/middleware.ts @@ -1,7 +1,7 @@ import { NextResponse } from 'next/server'; import type { NextRequest } from 'next/server'; -const baseURL = process.env.USER_SERVICE_URL || 'http://172.17.0.1:3001/api/v1'; +const baseURL = process.env.AUTH_SERVICE_URL || 'http://172.17.0.1:3001/api/v1'; // This function can be marked `async` if using `await` inside export async function middleware(request: NextRequest) { diff --git a/peerprep-fe/src/network/axiosClient.ts b/peerprep-fe/src/network/axiosClient.ts index 086ff35a72..ae4f2f6ac1 100644 --- a/peerprep-fe/src/network/axiosClient.ts +++ b/peerprep-fe/src/network/axiosClient.ts @@ -12,7 +12,7 @@ const axiosQuestionClient = axios.create({ const axiosAuthClient = axios.create({ baseURL: - process.env.NEXT_PUBLIC_USER_SERVICE_URL || 'http://localhost:3001/api/v1', + process.env.NEXT_PUBLIC_AUTH_SERVICE_URL || 'http://localhost:3001/api/v1', headers: { 'Content-Type': 'application/json', }, diff --git a/peerprep-fe/src/network/axiosServer.ts b/peerprep-fe/src/network/axiosServer.ts index f33b504538..483e87f7d9 100644 --- a/peerprep-fe/src/network/axiosServer.ts +++ b/peerprep-fe/src/network/axiosServer.ts @@ -10,7 +10,7 @@ const axiosQuestionServer = axios.create({ }); const axiosAuthServer = axios.create({ - baseURL: process.env.USER_SERVICE_URL || 'http://172.17.0.1:3001/api/v1', + baseURL: process.env.AUTH_SERVICE_URL || 'http://172.17.0.1:3001/api/v1', headers: { 'Content-Type': 'application/json', },