Skip to content

Commit

Permalink
fix: cleanup after testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Koufan-De-King committed Nov 25, 2024
1 parent da6b89c commit d3987ba
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 15 deletions.
3 changes: 1 addition & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
VITE_BACKEND_URL="https://mynameis"
VITE_FRONTEND_URL="https://mynameisnot
VITE_BACKEND_URL="FALLBACK_URL"
1 change: 0 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,5 @@ jobs:
context: .
build-args: |
VITE_BACKEND_URL=https://localhost:8555
VITE_FRONTEND_URL=https://localhost:8555
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ RUN npm run build
FROM nginx:alpine

ARG VITE_BACKEND_URL
ARG VITE_FRONTEND_URL

ENV VITE_BACKEND_URL=${VITE_BACKEND_URL}
ENV VITE_FRONTEND_URL=${VITE_FRONTEND_URL}

ARG PORT=80
ENV NGINX_PORT=${PORT}
Expand Down
1 change: 0 additions & 1 deletion compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ services:
ports:
- "2456:80"
environment:
VITE_FRONTEND_URL: http://localhost:8555'
VITE_BACKEND_URL: 'http://localhost:8555'
2 changes: 0 additions & 2 deletions src/services/keyManagement/apiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ export const sendOTP = async (fullPhoneNumber: string, jwtToken: string) => {
};

try {
console.log(envVariables.VITE_BACKEND_URL);
console.log(envVariables.VITE_FRONTEND_URL);
// Send the post request to the backend
const response = await axios.post(
`${envVariables.VITE_BACKEND_URL}/api/registration`,
Expand Down
13 changes: 6 additions & 7 deletions src/shared/projectEnvVariables.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
type ProjectEnvVariablesType = Pick<
ImportMetaEnv,
"VITE_BACKEND_URL" | "VITE_FRONTEND_URL"
"VITE_BACKEND_URL" | "VITE_OTHER_ENV_VARIABLE"
>;

const projectEnvVariables: ProjectEnvVariablesType = {
VITE_BACKEND_URL: "${VITE_BACKEND_URL}",
VITE_FRONTEND_URL: "${VITE_FRONTEND_URL}",
VITE_OTHER_ENV_VARIABLE: "${VITE_OTHER_ENV_VARIABLE}",
};

interface ProjectEnvVariables {
Expand All @@ -18,11 +18,10 @@ export const getProjectEnvVariables = (): ProjectEnvVariables => {
VITE_BACKEND_URL: !projectEnvVariables.VITE_BACKEND_URL.includes("VITE_")
? projectEnvVariables.VITE_BACKEND_URL
: import.meta.env.VITE_BACKEND_URL,
VITE_FRONTEND_URL: !projectEnvVariables.VITE_FRONTEND_URL.includes(
"VITE_",
)
? projectEnvVariables.VITE_FRONTEND_URL
: import.meta.env.VITE_FRONTEND_URL,
VITE_OTHER_ENV_VARIABLE:
!projectEnvVariables.VITE_OTHER_ENV_VARIABLE.includes("VITE_")
? projectEnvVariables.VITE_OTHER_ENV_VARIABLE
: import.meta.env.VITE_OTHER_ENV_VARIABLE,
},
};
};

0 comments on commit d3987ba

Please sign in to comment.