diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d39f022..8eeaacd 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -25,7 +25,7 @@ jobs: context: . file: ./Dockerfile push: true - tags: azpect3120/potion.gophernest:latest + tags: azpect3120/potion.backend:latest - name: Build and push frontend Docker image uses: docker/build-push-action@v5 @@ -36,5 +36,3 @@ jobs: tags: azpect3120/potion.frontend:latest build-args: | VITE_ENVIRONMENT=prod - VITE_DOMAIN_DEV=http://localhost:3000 - VITE_DOMAIN_PROD=https://potion-backend.gophernest.net diff --git a/web/Dockerfile b/web/Dockerfile index 99fc94d..5d08817 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -7,14 +7,9 @@ RUN npm install COPY . . -# Build-time config: defaults are prod-safe, can be overridden if needed +# Build-time config: just env selector ARG VITE_ENVIRONMENT=prod -ARG VITE_DOMAIN_DEV=http://localhost:3000 -ARG VITE_DOMAIN_PROD=https://potion-backend.gophernest.net - ENV VITE_ENVIRONMENT=$VITE_ENVIRONMENT -ENV VITE_DOMAIN_DEV=$VITE_DOMAIN_DEV -ENV VITE_DOMAIN_PROD=$VITE_DOMAIN_PROD RUN npm run build diff --git a/web/src/services/AuthService.ts b/web/src/services/AuthService.ts index 1adb4b3..460bc5f 100644 --- a/web/src/services/AuthService.ts +++ b/web/src/services/AuthService.ts @@ -1,7 +1,7 @@ import axios from "axios"; import type { GetGoogleAuthUrlResponse, LogoutResponse } from "../types/api/auth"; import type { ApiError } from "../types/api/error"; -import { GetBackendUrl } from "./util"; +import { GetBackendUrl } from "./environment"; const BACKEND_URL = GetBackendUrl(); diff --git a/web/src/services/EngagementService.ts b/web/src/services/EngagementService.ts index 6677c20..1187b29 100644 --- a/web/src/services/EngagementService.ts +++ b/web/src/services/EngagementService.ts @@ -2,7 +2,7 @@ import axios from "axios"; import type { ApiError } from "../types/api/error"; import type { Engagement } from "../types/engagement"; import type { EngagementFavoriteRecipeResponse, EngagementMakeRecipeResponse, EngagementShareRecipeResponse, EngagementViewRecipeResponse } from "../types/api/engagement"; -import { GetBackendUrl } from "./util"; +import { GetBackendUrl } from "./environment"; const BACKEND_URL = GetBackendUrl(); diff --git a/web/src/services/RecipeService.ts b/web/src/services/RecipeService.ts index fd2a7c2..b4e17bc 100644 --- a/web/src/services/RecipeService.ts +++ b/web/src/services/RecipeService.ts @@ -3,7 +3,7 @@ import type { CreateRecipeRequest, CreateRecipeResponse, GetRecipeOfTheWeekRespo import type { Recipe } from "../types/recipe"; import type { ApiError } from "../types/api/error"; import type { SearchFilters } from "../types/search"; -import { GetBackendUrl } from "./util"; +import { GetBackendUrl } from "./environment"; const BACKEND_URL = GetBackendUrl(); diff --git a/web/src/services/UserService.ts b/web/src/services/UserService.ts index b9f8b63..2135937 100644 --- a/web/src/services/UserService.ts +++ b/web/src/services/UserService.ts @@ -4,7 +4,7 @@ import type { User } from "../types/user"; import type { GetAuthenticateUserEngagementResponse, GetAuthenticateUserFavoritesResponse, GetAuthenticateUserMadeRecipesResponse, GetAuthenticateUserRecipesResponse, GetAuthenticateUserResponse, GetAuthenticateUserViewedRecipesResponse, GetUserResponse } from "../types/api/user"; import type { Recipe } from "../types/recipe"; import type { Engagement } from "../types/engagement"; -import { GetBackendUrl } from "./util"; +import { GetBackendUrl } from "./environment"; const BACKEND_URL = GetBackendUrl(); diff --git a/web/src/services/util.ts b/web/src/services/environment.ts similarity index 72% rename from web/src/services/util.ts rename to web/src/services/environment.ts index e749dce..3dba376 100644 --- a/web/src/services/util.ts +++ b/web/src/services/environment.ts @@ -6,9 +6,9 @@ export function GetBackendUrl(): string { switch (env.toLowerCase()) { case "dev": - return ENV.VITE_DOMAIN_DEV as string; + return "http://localhost:3000"; case "prod": - return ENV.VITE_DOMAIN_PROD as string; + return "https://potion-backend.gophernest.net"; default: return "" }