Use internal backend URL for frontend server runtime
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
const API_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3001/api';
|
||||
import { SERVER_API_URL as API_URL } from './src/lib/server-api';
|
||||
const AUTH_COOKIE = 'wa_session';
|
||||
const REFRESH_COOKIE = 'wa_refresh';
|
||||
const SESSION_REFRESH_LEEWAY_SECONDS = 60;
|
||||
|
||||
@ -10,8 +10,8 @@ import {
|
||||
twoFactorEmailCookieName,
|
||||
} from '../lib/auth';
|
||||
import { defaultLocale, isLocale, localeCookieName } from '../lib/i18n';
|
||||
import { SERVER_API_URL as API_URL } from '../lib/server-api';
|
||||
|
||||
const API_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3001/api';
|
||||
const secureCookies = process.env.NODE_ENV === 'production';
|
||||
|
||||
type FormState = {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
const API_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3001/api';
|
||||
import { SERVER_API_URL as API_URL } from './server-api';
|
||||
|
||||
async function readJson<T>(response: Response): Promise<T> {
|
||||
const payload = await response.json();
|
||||
|
||||
3
frontend/src/lib/server-api.ts
Normal file
3
frontend/src/lib/server-api.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export const SERVER_API_URL =
|
||||
process.env.INTERNAL_API_URL?.trim() ||
|
||||
'http://127.0.0.1:3001/api';
|
||||
Reference in New Issue
Block a user