add API_URl env var to client

This commit is contained in:
Max Leiter 2022-03-07 23:09:30 -08:00
parent a838069472
commit b48d1ea745
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: A3512F2F2F17EBDA
4 changed files with 11 additions and 1 deletions

1
client/.env Normal file
View file

@ -0,0 +1 @@
API_URL=http://localhost:3000

View file

@ -1,3 +1,6 @@
const dotenv = require("dotenv");
dotenv.config();
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {
reactStrictMode: true, reactStrictMode: true,
@ -8,7 +11,7 @@ const nextConfig = {
return [ return [
{ {
source: "/api/:path*", source: "/api/:path*",
destination: "http://localhost:3000/:path*", destination: `${process.env.API_URL}/:path*`,
}, },
]; ];
}, },

View file

@ -12,6 +12,7 @@
"@geist-ui/core": "^2.3.5", "@geist-ui/core": "^2.3.5",
"@geist-ui/icons": "^1.0.1", "@geist-ui/icons": "^1.0.1",
"comlink": "^4.3.1", "comlink": "^4.3.1",
"dotenv": "^16.0.0",
"next": "12.1.0", "next": "12.1.0",
"prismjs": "^1.27.0", "prismjs": "^1.27.0",
"react": "17.0.2", "react": "17.0.2",

View file

@ -537,6 +537,11 @@ doctrine@^3.0.0:
dependencies: dependencies:
esutils "^2.0.2" esutils "^2.0.2"
dotenv@^16.0.0:
version "16.0.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.0.tgz#c619001253be89ebb638d027b609c75c26e47411"
integrity sha512-qD9WU0MPM4SWLPJy/r2Be+2WgQj8plChsyrCNQzW/0WjvcJQiKQJ9mH3ZgB3fxbUUxgc/11ZJ0Fi5KiimWGz2Q==
emoji-regex@^9.2.2: emoji-regex@^9.2.2:
version "9.2.2" version "9.2.2"
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72"