Added PRODUCTION env variable to client

This commit is contained in:
2021-03-04 10:53:13 +11:00
parent 488f975e98
commit dccf55c973
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ const route = async (req, res) => {
try { try {
//reserve the UUID with the chat server (hop 1) //reserve the UUID with the chat server (hop 1)
const result = await fetch(`http://${process.env.CHAT_URI}/reserve`, { method: 'POST', body: form }); const result = await fetch(`http${process.env.PRODUCTION ? 's' : ''}://${process.env.CHAT_URI}/reserve`, { method: 'POST', body: form });
if (result.status == 200) { if (result.status == 200) {
const json = await result.json(); const json = await result.json();
+1
View File
@@ -50,6 +50,7 @@ module.exports = ({ production, analyzer }) => {
plugins: [ plugins: [
new DefinePlugin({ new DefinePlugin({
'process.env': { 'process.env': {
'PRODUCTION': production,
'NEWS_URI': production ? `"${process.env.NEWS_URI}"` : '"http://dev-news.eggtrainer.com:3100/news"', 'NEWS_URI': production ? `"${process.env.NEWS_URI}"` : '"http://dev-news.eggtrainer.com:3100/news"',
/* TODO: (1) NEWS_KEY needs to be set in the server, and auth'd via admin accounts, NOT embedded in the client */ /* TODO: (1) NEWS_KEY needs to be set in the server, and auth'd via admin accounts, NOT embedded in the client */
'NEWS_KEY': production ? `"${process.env.NEWS_KEY}"` : '"key"', 'NEWS_KEY': production ? `"${process.env.NEWS_KEY}"` : '"key"',