Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
295e03feb4 |
@@ -10,8 +10,6 @@ JWT_SECRET=your-super-secret-jwt-key-minimum-32-characters-change-in-production
|
||||
ENCRYPTION_KEY=A5CC60AB92FCA026F5477DC486555882
|
||||
FRONTEND_URL="http://localhost"
|
||||
|
||||
VITE_API_BASE_URL="http://localhost"
|
||||
|
||||
# Default Admin
|
||||
DEFAULT_ADMIN_EMAIL=admin@notely.local
|
||||
DEFAULT_ADMIN_USERNAME=admin
|
||||
|
||||
@@ -46,8 +46,6 @@ jobs:
|
||||
context: .
|
||||
file: ./devops/docker/Dockerfile
|
||||
push: true
|
||||
build-args: |
|
||||
VITE_API_BASE_URL=${{ secrets.VITE_API_BASE_URL }}
|
||||
tags: |
|
||||
${{ env.IMAGE_NAME }}:latest
|
||||
${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.short_sha }}
|
||||
|
||||
@@ -21,7 +21,6 @@ Required or commonly used:
|
||||
- `JWT_SECRET`
|
||||
- `ENCRYPTION_KEY`
|
||||
- `FRONTEND_URL`
|
||||
- `VITE_API_BASE_URL`
|
||||
- `DEFAULT_ADMIN_EMAIL`
|
||||
- `DEFAULT_ADMIN_USERNAME`
|
||||
- `DEFAULT_ADMIN_PASSWORD`
|
||||
@@ -41,7 +40,6 @@ Optional backend runtime values that Docker Compose will also pass through if pr
|
||||
- MongoDB container: `mongodb://admin:password@mongodb:27017/noteapp?authSource=admin`
|
||||
- Backend port: `8080`
|
||||
- Public frontend URL: `http://localhost`
|
||||
- Browser API base URL for container builds: `http://localhost`
|
||||
|
||||
## 2. `backend/.env`
|
||||
|
||||
@@ -107,13 +105,12 @@ cp .env.example .env
|
||||
|
||||
### Frontend Variables In `frontend/.env.example`
|
||||
|
||||
- `VITE_API_BASE_URL`
|
||||
- `VITE_ENV`
|
||||
- `VITE_ENABLE_ANALYTICS`
|
||||
|
||||
### Variables Currently Relevant To The Frontend App
|
||||
|
||||
- `VITE_API_BASE_URL`: used by the API client
|
||||
- API requests are sent to the current browser origin (same-origin runtime behavior)
|
||||
|
||||
The other example values are safe to keep, but the current checked-in frontend code does not actively consume them.
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ Check `REDIS_ADDR`, `REDIS_PASSWORD`, and `REDIS_DB`. For local defaults, Redis
|
||||
Check:
|
||||
|
||||
- backend is running on port `8080`
|
||||
- frontend `VITE_API_BASE_URL`
|
||||
- frontend and API are reachable through the same host/origin
|
||||
- Vite proxy settings in `frontend/vite.config.js`
|
||||
|
||||
### OAuth callback redirects to the wrong URL
|
||||
|
||||
@@ -3,9 +3,6 @@ FROM node:25-alpine AS frontend-builder
|
||||
|
||||
WORKDIR /frontend
|
||||
|
||||
ARG VITE_API_BASE_URL
|
||||
ENV VITE_API_BASE_URL=${VITE_API_BASE_URL}
|
||||
|
||||
COPY frontend/package*.json ./
|
||||
RUN npm install
|
||||
|
||||
|
||||
@@ -36,8 +36,6 @@ services:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./devops/docker/Dockerfile
|
||||
args:
|
||||
VITE_API_BASE_URL: ${VITE_API_BASE_URL}
|
||||
container_name: notely-app
|
||||
ports:
|
||||
- "${BACKEND_PORT}:${BACKEND_PORT}"
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
# Frontend Environment Example
|
||||
|
||||
# API Base URL (Backend server)
|
||||
VITE_API_BASE_URL=http://localhost:8080
|
||||
|
||||
# Environment
|
||||
VITE_ENV=development
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import axios from "axios";
|
||||
import { useAuthStore } from "../stores/authStore";
|
||||
|
||||
const runtimeOrigin = typeof window !== "undefined" ? window.location.origin : "";
|
||||
|
||||
const apiClient = axios.create({
|
||||
baseURL: import.meta.env.VITE_API_BASE_URL || "http://localhost:8080",
|
||||
baseURL: runtimeOrigin,
|
||||
withCredentials: true,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user