feat: configure ports, db url and api url with env variables

This commit is contained in:
Elias Schneider
2023-04-25 23:39:57 +02:00
parent b33c1d7f4b
commit e5071cba12
6 changed files with 17 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
import { NextApiRequest, NextApiResponse } from "next";
import httpProxyMiddleware from "next-http-proxy-middleware";
import getConfig from "next/config";
export const config = {
api: {
@@ -8,11 +9,13 @@ export const config = {
},
};
const { apiURL } = getConfig().serverRuntimeConfig;
export default (req: NextApiRequest, res: NextApiResponse) => {
return httpProxyMiddleware(req, res, {
headers: {
"X-Forwarded-For": req.socket?.remoteAddress ?? "",
},
target: "http://localhost:8080",
target: apiURL,
});
};