feat: add next.config rewrites for shortlink routing and show domain in UI
This commit is contained in:
@@ -6,6 +6,9 @@ RUN npm ci
|
|||||||
ARG NEXT_PUBLIC_API_URL
|
ARG NEXT_PUBLIC_API_URL
|
||||||
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
|
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
|
||||||
|
|
||||||
|
ARG NEXT_PUBLIC_APP_URL
|
||||||
|
ENV NEXT_PUBLIC_APP_URL=$NEXT_PUBLIC_APP_URL
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,15 @@
|
|||||||
import type { NextConfig } from "next";
|
import type { NextConfig } from "next";
|
||||||
|
|
||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
|
|
||||||
output: 'standalone',
|
output: 'standalone',
|
||||||
|
async rewrites() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
source: '/l/:slug',
|
||||||
|
destination: `${process.env.INTERNAL_BACKEND_URL || 'http://localhost:4001'}/l/:slug`
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default nextConfig;
|
export default nextConfig;
|
||||||
|
|||||||
@@ -123,9 +123,9 @@ export default function CreateQRPage() {
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-medium text-gray-700 mb-1">Custom Short Link (Optional)</label>
|
<label className="block text-sm font-medium text-gray-700 mb-1">Custom Short Link (Optional)</label>
|
||||||
<div className="flex shadow-sm rounded-lg overflow-hidden border border-gray-300 focus-within:ring-2 focus-within:ring-indigo-500">
|
<div className="flex flex-col sm:flex-row shadow-sm rounded-lg overflow-hidden border border-gray-300 focus-within:ring-2 focus-within:ring-indigo-500">
|
||||||
<span className="inline-flex items-center px-4 bg-gray-50 text-gray-500 border-r border-gray-300 text-sm">
|
<span className="inline-flex items-center px-4 bg-gray-50 text-gray-500 border-r border-gray-300 text-sm whitespace-nowrap">
|
||||||
/l/
|
{(process.env.NEXT_PUBLIC_APP_URL || 'https://qr.houseofwebsites.ai').replace(/^https?:\/\//, '')}/l/
|
||||||
</span>
|
</span>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ services:
|
|||||||
- "4000"
|
- "4000"
|
||||||
environment:
|
environment:
|
||||||
- PORT=4000
|
- PORT=4000
|
||||||
|
- INTERNAL_BACKEND_URL=http://backend:4001
|
||||||
|
- NEXT_PUBLIC_APP_URL=${FRONTEND_URL:-https://qr.houseofwebsites.ai}
|
||||||
depends_on:
|
depends_on:
|
||||||
- backend
|
- backend
|
||||||
|
|
||||||
@@ -27,6 +29,7 @@ services:
|
|||||||
- PGDATABASE=ckqr
|
- PGDATABASE=ckqr
|
||||||
- REDIS_HOST=redis
|
- REDIS_HOST=redis
|
||||||
- REDIS_PORT=6379
|
- REDIS_PORT=6379
|
||||||
|
- BASE_URL=${FRONTEND_URL:-https://qr.houseofwebsites.ai}
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
- redis
|
- redis
|
||||||
|
|||||||
Reference in New Issue
Block a user