fix first production issues
Web Client CI/CD / Lint (ESLint + TypeScript) (push) Successful in 40s
Web Client CI/CD / Build (tsc + Vite) (push) Successful in 24s
Web Client CI/CD / Deploy to shared hosting (push) Successful in 33s

This commit is contained in:
root
2026-07-10 03:43:47 -04:00
parent b895c06dc1
commit c6d2bc007e
8 changed files with 536 additions and 549 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ After pushing, the pipeline will run automatically. The following steps are requ
| `SSH_PORT` | `22` | SSH port for the deployment server |
| `SSH_TARGET_DIR` | — | Absolute path on the server where `dist/` contents should be placed |
| `PRODUCTION_URL` | — | Public URL of the production site |
| `VITE_API_ORIGIN` | — | (Optional) API base URL passed at build time |
| `VITE_API_URL` | — | (Optional) API base URL passed at build time |
## 3. Allow Gitea Actions
+2 -2
View File
@@ -80,7 +80,7 @@ jobs:
- name: Build project
run: npm run build
env:
VITE_API_ORIGIN: ${{ vars.VITE_API_ORIGIN || '' }}
VITE_API_URL: ${{ vars.VITE_API_URL || '' }}
# ──────────────────────────────────────────────
# DEPLOY (manual): to shared hosting via SSH
@@ -117,7 +117,7 @@ jobs:
- name: Build project
run: npm run build
env:
VITE_API_ORIGIN: ${{ vars.VITE_API_ORIGIN || '' }}
VITE_API_URL: ${{ vars.VITE_API_URL || '' }}
- name: Install SSH and rsync
run: |
+2 -2
View File
@@ -19,8 +19,8 @@ RUN npm install --no-audit --no-fund
COPY . .
ARG VITE_API_ORIGIN=
ENV VITE_API_ORIGIN=$VITE_API_ORIGIN
ARG VITE_API_URL=
ENV VITE_API_URL=$VITE_API_URL
RUN npm run build
+1 -1
View File
@@ -21,7 +21,7 @@ services:
context: .
dockerfile: Dockerfile
args:
VITE_API_ORIGIN: ${VITE_API_ORIGIN:-}
VITE_API_URL: ${VITE_API_URL:-}
NPM_STRICT_SSL: ${NPM_STRICT_SSL:-true}
ports:
- '8080:80'
+524 -537
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -89,7 +89,7 @@ export async function apiFetch<T>(
})
} catch (e) {
const hint = import.meta.env.DEV
? ' Start the API and ensure Vite can reach it. Default proxy is http://localhost:8000 unless VITE_PROXY_API or VITE_API_ORIGIN is set.'
? ' Start the API and ensure Vite can reach it. Default proxy is http://localhost:8000 unless VITE_PROXY_API or VITE_API_URL is set.'
: ''
const reason = e instanceof Error ? e.message : 'Failed to fetch'
+4 -4
View File
@@ -4,14 +4,14 @@ const PROD_API_ORIGIN = 'https://api.alrahmaisgl.org'
* Laravel API base URL.
*
* Dev defaults to same-origin `/api/...` so Vite can proxy requests to Laravel.
* Set `VITE_API_ORIGIN` when you want the browser to call Laravel directly, e.g.
* `VITE_API_ORIGIN=http://localhost:8000 npm run dev`.
* Set `VITE_API_URL` when you want the browser to call Laravel directly, e.g.
* `VITE_API_URL=http://localhost:8000 npm run dev`.
*
* If `VITE_API_ORIGIN` is not set in dev, `vite.config.ts` proxies `/api` to
* If `VITE_API_URL` is not set in dev, `vite.config.ts` proxies `/api` to
* `VITE_PROXY_API` or `http://localhost:8000` by default.
*/
export function apiOrigin(): string {
const v = import.meta.env.VITE_API_ORIGIN
const v = import.meta.env.VITE_API_URL
if (typeof v === 'string' && v.trim()) {
return v.replace(/\/$/, '')
}
+1 -1
View File
@@ -2,7 +2,7 @@ import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
/** Laravel API for dev proxy (`/api` → this host). Override: `VITE_PROXY_API=http://localhost:8000 npm run dev`. */
const apiTarget = process.env.VITE_PROXY_API ?? process.env.VITE_API_ORIGIN ?? 'http://localhost:8000'
const apiTarget = process.env.VITE_PROXY_API ?? process.env.VITE_API_URL ?? 'http://localhost:8000'
// https://vite.dev/config/
export default defineConfig({