Skip to content

Commit

Permalink
Merge pull request #220 from DocShow-AI/fix_one_result
Browse files Browse the repository at this point in the history
integrate app env
  • Loading branch information
liberty-rising authored Jan 20, 2024
2 parents ff48288 + 2ac8651 commit 50c7561
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

- name: Build and Push Frontend Docker Image
run: |
docker build --build-arg VITE_API_URL=${{ secrets.VITE_API_URL }} -t registry.digitalocean.com/docshow-ai/frontend-prod:${{ github.sha }} -f frontend/Dockerfile.prod frontend/
docker build --build-arg VITE_API_URL=${{ secrets.VITE_API_URL }} --build-arg VITE_APP_ENV=${{ secrets.VITE_APP_ENV }} -t registry.digitalocean.com/docshow-ai/frontend-prod:${{ github.sha }} -f frontend/Dockerfile.prod frontend/
echo ${{ secrets.REGISTRY_PASSWORD }} | docker login registry.digitalocean.com -u ${{ secrets.REGISTRY_USERNAME }} --password-stdin
docker push registry.digitalocean.com/docshow-ai/frontend-prod:${{ github.sha }}
Expand Down
2 changes: 2 additions & 0 deletions frontend/Dockerfile.prod
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ COPY . .
# Set the VITE_API_URL environment variable (VITE env variables are set during build time)
ARG VITE_API_URL
ENV VITE_API_URL=$VITE_API_URL
ARG VITE_APP_ENV
ENV VITE_APP_ENV=$VITE_APP_ENV

# Build the app
RUN npm run build
Expand Down
14 changes: 10 additions & 4 deletions frontend/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { React } from "react";
import React, { useEffect } from "react";
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
import "./api/axiosInterceptor";
import { AuthProvider, useAuth } from "./contexts/AuthContext";
import { APP_ENV } from "./utils/constants";
import AppLayout from "./components/layouts/AppLayout";
import LandingLayout from "./components/layouts/LandingLayout";
import RequireAuth from "./components/auth/RequireAuth";
Expand All @@ -13,17 +14,14 @@ import BlogPage from "./pages/blog/BlogPage";
import ChangePasswordPage from "./pages/change-password/ChangePasswordPage";
import CreateChartPage from "./pages/charts/CreateChartPage";
import CreateDashboardPage from "./pages/dashboards/CreateDashboard";
import CreateDataProfile from "./pages/data-profiling/CreateDataProfile";
import DashboardMenuPage from "./pages/dashboards/DashboardsMenuPage";
import Dashboard from "./pages/dashboards/Dashboard";
import DataProfilingPage from "./pages/data-profiling/DataProfilingPage";
import ForgotPasswordPage from "./pages/forgot-password/ForgotPasswordPage";
import LandingPage from "./pages/landing/LandingPage";
import LoginPage from "./pages/login/LoginPage";
import PricingPage from "./pages/pricing/PricingPage";
import RegisterPage from "./pages/register/RegisterPage";
import ResetPasswordPage from "./pages/reset-password/ResetPasswordPage";
import SpecificDataProfilePage from "./pages/data-profiling/SpecificDataProfilePage";
import UploadPage from "./pages/upload/UploadPage";
import UserPage from "./pages/user/UserPage";
import VerifyEmailPage from "./pages/verify-email/VerifyEmailPage";
Expand All @@ -46,6 +44,14 @@ function App() {
return <div>Loading...</div>; // Or any other loading indicator
}

useEffect(() => {
if (APP_ENV === "dev") {
document.title = "DocShow AI - Dev";
} else {
document.title = "DocShow AI";
}
}, []);

return (
<Routes>
<Route
Expand Down
1 change: 1 addition & 0 deletions frontend/src/utils/constants.jsx
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export const API_URL = import.meta.env.VITE_API_URL;
export const APP_ENV = import.meta.env.VITE_APP_ENV;

0 comments on commit 50c7561

Please sign in to comment.