Added PRODUCTION env variable to client
This commit is contained in:
@@ -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();
|
||||||
|
|||||||
@@ -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"',
|
||||||
|
|||||||
Reference in New Issue
Block a user