fix: removed hardcoded api url
All checks were successful
Build and Push App Image / build-and-push (push) Successful in 1m20s
All checks were successful
Build and Push App Image / build-and-push (push) Successful in 1m20s
This commit is contained in:
@@ -10,8 +10,6 @@ JWT_SECRET=your-super-secret-jwt-key-minimum-32-characters-change-in-production
|
|||||||
ENCRYPTION_KEY=A5CC60AB92FCA026F5477DC486555882
|
ENCRYPTION_KEY=A5CC60AB92FCA026F5477DC486555882
|
||||||
FRONTEND_URL="http://localhost"
|
FRONTEND_URL="http://localhost"
|
||||||
|
|
||||||
VITE_API_BASE_URL="http://localhost"
|
|
||||||
|
|
||||||
# Default Admin
|
# Default Admin
|
||||||
DEFAULT_ADMIN_EMAIL=admin@notely.local
|
DEFAULT_ADMIN_EMAIL=admin@notely.local
|
||||||
DEFAULT_ADMIN_USERNAME=admin
|
DEFAULT_ADMIN_USERNAME=admin
|
||||||
|
|||||||
@@ -46,8 +46,6 @@ jobs:
|
|||||||
context: .
|
context: .
|
||||||
file: ./devops/docker/Dockerfile
|
file: ./devops/docker/Dockerfile
|
||||||
push: true
|
push: true
|
||||||
build-args: |
|
|
||||||
VITE_API_BASE_URL=${{ secrets.VITE_API_BASE_URL }}
|
|
||||||
tags: |
|
tags: |
|
||||||
${{ env.IMAGE_NAME }}:latest
|
${{ env.IMAGE_NAME }}:latest
|
||||||
${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.short_sha }}
|
${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.short_sha }}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ Required or commonly used:
|
|||||||
- `JWT_SECRET`
|
- `JWT_SECRET`
|
||||||
- `ENCRYPTION_KEY`
|
- `ENCRYPTION_KEY`
|
||||||
- `FRONTEND_URL`
|
- `FRONTEND_URL`
|
||||||
- `VITE_API_BASE_URL`
|
|
||||||
- `DEFAULT_ADMIN_EMAIL`
|
- `DEFAULT_ADMIN_EMAIL`
|
||||||
- `DEFAULT_ADMIN_USERNAME`
|
- `DEFAULT_ADMIN_USERNAME`
|
||||||
- `DEFAULT_ADMIN_PASSWORD`
|
- `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`
|
- MongoDB container: `mongodb://admin:password@mongodb:27017/noteapp?authSource=admin`
|
||||||
- Backend port: `8080`
|
- Backend port: `8080`
|
||||||
- Public frontend URL: `http://localhost`
|
- Public frontend URL: `http://localhost`
|
||||||
- Browser API base URL for container builds: `http://localhost`
|
|
||||||
|
|
||||||
## 2. `backend/.env`
|
## 2. `backend/.env`
|
||||||
|
|
||||||
@@ -107,13 +105,12 @@ cp .env.example .env
|
|||||||
|
|
||||||
### Frontend Variables In `frontend/.env.example`
|
### Frontend Variables In `frontend/.env.example`
|
||||||
|
|
||||||
- `VITE_API_BASE_URL`
|
|
||||||
- `VITE_ENV`
|
- `VITE_ENV`
|
||||||
- `VITE_ENABLE_ANALYTICS`
|
- `VITE_ENABLE_ANALYTICS`
|
||||||
|
|
||||||
### Variables Currently Relevant To The Frontend App
|
### 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.
|
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:
|
Check:
|
||||||
|
|
||||||
- backend is running on port `8080`
|
- 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`
|
- Vite proxy settings in `frontend/vite.config.js`
|
||||||
|
|
||||||
### OAuth callback redirects to the wrong URL
|
### OAuth callback redirects to the wrong URL
|
||||||
|
|||||||
@@ -3,9 +3,6 @@ FROM node:25-alpine AS frontend-builder
|
|||||||
|
|
||||||
WORKDIR /frontend
|
WORKDIR /frontend
|
||||||
|
|
||||||
ARG VITE_API_BASE_URL
|
|
||||||
ENV VITE_API_BASE_URL=${VITE_API_BASE_URL}
|
|
||||||
|
|
||||||
COPY frontend/package*.json ./
|
COPY frontend/package*.json ./
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./devops/docker/Dockerfile
|
dockerfile: ./devops/docker/Dockerfile
|
||||||
args:
|
|
||||||
VITE_API_BASE_URL: ${VITE_API_BASE_URL}
|
|
||||||
container_name: notely-app
|
container_name: notely-app
|
||||||
ports:
|
ports:
|
||||||
- "${BACKEND_PORT}:${BACKEND_PORT}"
|
- "${BACKEND_PORT}:${BACKEND_PORT}"
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
# Frontend Environment Example
|
# Frontend Environment Example
|
||||||
|
|
||||||
# API Base URL (Backend server)
|
|
||||||
VITE_API_BASE_URL=http://localhost:8080
|
|
||||||
|
|
||||||
# Environment
|
# Environment
|
||||||
VITE_ENV=development
|
VITE_ENV=development
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { useAuthStore } from "../stores/authStore";
|
import { useAuthStore } from "../stores/authStore";
|
||||||
|
|
||||||
|
const runtimeOrigin = typeof window !== "undefined" ? window.location.origin : "";
|
||||||
|
|
||||||
const apiClient = axios.create({
|
const apiClient = axios.create({
|
||||||
baseURL: import.meta.env.VITE_API_BASE_URL || "http://localhost:8080",
|
baseURL: runtimeOrigin,
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user