DONE: update to use ip for the api in frontend
This commit is contained in:
+2
-13
@@ -1,25 +1,14 @@
|
||||
# Host ports (used until nginx terminates TLS on 443)
|
||||
# Host ports (nginx terminates TLS on 443 and proxies to these)
|
||||
ADMIN_HOST_PORT=5000
|
||||
TELLER_HOST_PORT=3001
|
||||
CUSTOMER_HOST_PORT=3000
|
||||
|
||||
# Domains — also set these as Gitea secrets, then rebuild FE images
|
||||
# VITE_API_URL / NEXT_PUBLIC_API_URL = https://qms-api.erahn.com.my
|
||||
# VITE_CUSTOMER_APP_URL = https://qms-customer.erahn.com.my
|
||||
VITE_API_URL=https://qms-api.erahn.com.my
|
||||
VITE_CUSTOMER_APP_URL=https://qms-customer.erahn.com.my
|
||||
NEXT_PUBLIC_API_URL=https://qms-api.erahn.com.my
|
||||
VITE_BRANCH_QR_BASE_URL=https://qms-customer.erahn.com.my
|
||||
|
||||
# Public app URLs (reference for nginx / bookmarks)
|
||||
# ADMIN: https://qms-admin.erahn.com.my
|
||||
# TELLER: https://qms-teller.erahn.com.my
|
||||
# CUSTOMER: https://qms-customer.erahn.com.my
|
||||
# API: https://qms-api.erahn.com.my
|
||||
|
||||
# Runtime (customer Next.js server)
|
||||
QR_TOKEN_SECRET=qms-branch-qr-v1
|
||||
|
||||
# Registry images (used by compose / deploy)
|
||||
ADMIN_IMAGE=git.koppkb.com/kopkb/qms-fe-admin
|
||||
TELLER_IMAGE=git.koppkb.com/kopkb/qms-fe-teller
|
||||
CUSTOMER_IMAGE=git.koppkb.com/kopkb/qms-fe-customer
|
||||
|
||||
@@ -4,6 +4,7 @@ CUSTOMER_HOST_PORT=3000
|
||||
|
||||
VITE_API_URL=https://qms-api.erahn.com.my
|
||||
NEXT_PUBLIC_API_URL=https://qms-api.erahn.com.my
|
||||
VITE_BRANCH_QR_BASE_URL=https://qms-customer.erahn.com.my
|
||||
|
||||
QR_TOKEN_SECRET=qms-branch-qr-v1
|
||||
|
||||
|
||||
@@ -4,10 +4,11 @@ CUSTOMER_HOST_PORT=3000
|
||||
|
||||
VITE_API_URL=https://qms-api.erahn.com.my
|
||||
NEXT_PUBLIC_API_URL=https://qms-api.erahn.com.my
|
||||
VITE_BRANCH_QR_BASE_URL=https://qms-customer.erahn.com.my
|
||||
|
||||
QR_TOKEN_SECRET=qms-branch-qr-v1
|
||||
|
||||
ADMIN_IMAGE=git.koppkb.com/kopkb/qms-fe-admin
|
||||
TELLER_IMAGE=git.koppkb.com/kopkb/qms-fe-teller
|
||||
CUSTOMER_IMAGE=git.koppkb.com/kopkb/qms-fe-customer
|
||||
IMAGE_TAG=local
|
||||
IMAGE_TAG=local
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
VITE_API_URL=https://qms-api.erahn.com.my
|
||||
VITE_BRANCH_QR_BASE_URL=https://qms-customer.erahn.com.my
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
# Baked into the admin image at build time (Gitea secret VITE_API_URL)
|
||||
VITE_API_URL=https://qms-api.erahn.com.my
|
||||
VITE_BRANCH_QR_BASE_URL=https://qms-customer.erahn.com.my
|
||||
|
||||
@@ -3,7 +3,9 @@ FROM node:20-bookworm AS build
|
||||
WORKDIR /app
|
||||
|
||||
ARG VITE_API_URL=http://localhost:8080
|
||||
ARG VITE_BRANCH_QR_BASE_URL=http://localhost:3000
|
||||
ENV VITE_API_URL=$VITE_API_URL
|
||||
ENV VITE_BRANCH_QR_BASE_URL=$VITE_BRANCH_QR_BASE_URL
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
export const SERVER_URL = import.meta.env.VITE_API_URL;
|
||||
|
||||
export const CUSTOMER_APP_URL = 'https://qms-customer.erahn.com.my';
|
||||
/** Public base URL encoded into branch QR codes (ManageBranchesScreen only). */
|
||||
export const BRANCH_QR_BASE_URL =
|
||||
import.meta.env.VITE_BRANCH_QR_BASE_URL ?? 'http://localhost:3000';
|
||||
|
||||
export const ROLES = {
|
||||
ROLE_SUPER_ADMIN: 'ROLE_SUPER_ADMIN',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import QRCode from 'qrcode';
|
||||
import { CUSTOMER_APP_URL } from '../constants.js';
|
||||
import { BRANCH_QR_BASE_URL } from '../constants.js';
|
||||
|
||||
const DEFAULT_QR_SECRET = 'qms-branch-qr-v1';
|
||||
|
||||
@@ -54,7 +54,7 @@ export function decodeBranchQrToken(token, secret = getQrSecret()) {
|
||||
}
|
||||
|
||||
export function getBranchTicketUrl(tenantCode, branchId) {
|
||||
const base = CUSTOMER_APP_URL.replace(/\/$/, '');
|
||||
const base = BRANCH_QR_BASE_URL.replace(/\/$/, '');
|
||||
const token = encodeBranchQrToken(tenantCode, branchId);
|
||||
return `${base}/q/${token}`;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ services:
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
VITE_API_URL: ${VITE_API_URL:-http://localhost:8080}
|
||||
VITE_BRANCH_QR_BASE_URL: ${VITE_BRANCH_QR_BASE_URL:-http://localhost:3000}
|
||||
container_name: qms-fe-admin
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
|
||||
Reference in New Issue
Block a user