Refactor API URLs and add environment config example
Replaces hardcoded production API URLs with localhost defaults for local development in both server and client code. Updates Dockerfile to require API URLs via deployment environment variables. Improves ChatTable to use a batch endpoint for chats and unread counts, with backward compatibility. Adds an env.example file to document required environment variables. Updates next.config.mjs to use environment variables for backend API rewrites and image domains.
This commit is contained in:
@@ -16,22 +16,23 @@ const baseConfig = {
|
||||
protocol: "https",
|
||||
hostname: "telegram.org",
|
||||
},
|
||||
{
|
||||
// Backend API hostname configured via environment variable
|
||||
...(process.env.API_HOSTNAME ? [{
|
||||
protocol: "https",
|
||||
hostname: "internal-api.inboxi.ng",
|
||||
},
|
||||
hostname: process.env.API_HOSTNAME,
|
||||
}] : []),
|
||||
],
|
||||
},
|
||||
async rewrites() {
|
||||
return [
|
||||
{
|
||||
source: '/api/:path*',
|
||||
destination: 'https://internal-api.inboxi.ng/api/:path*',
|
||||
destination: `${process.env.API_BASE_URL || 'http://localhost:3001'}/api/:path*`,
|
||||
},
|
||||
];
|
||||
},
|
||||
experimental: {
|
||||
serverExternalPackages: [],
|
||||
// serverExternalPackages has been deprecated in Next.js 15
|
||||
},
|
||||
onDemandEntries: {
|
||||
maxInactiveAge: 15 * 1000,
|
||||
|
||||
Reference in New Issue
Block a user