diff --git a/client/.env.development.imex b/client/.env.development.imex index de1bbecf3..968dbab37 100644 --- a/client/.env.development.imex +++ b/client/.env.development.imex @@ -8,7 +8,7 @@ VITE_APP_CLOUDINARY_API_KEY=957865933348715 VITE_APP_CLOUDINARY_THUMB_TRANSFORMATIONS=c_fill,h_250,w_250 VITE_APP_FIREBASE_PUBLIC_VAPID_KEY='BG3tzU7L2BXlGZ_3VLK4PNaRceoEXEnmHfxcVbRMF5o5g05ejslhVPki9kBM9cBBT-08Ad9kN3HSpS6JmrWD6h4' VITE_APP_STRIPE_PUBLIC_KEY=pk_test_51GqB4TJl3nQjrZ0wCQWAxAhlNF8jKe0tipIa6ExBaxwJGitwvFsIZUEua4dUzaMIAuXp4qwYHXx7lgjyQSwP0Pe900vzm38C7g -VITE_APP_AXIOS_BASE_API_URL=https://localhost:4000 +VITE_APP_AXIOS_BASE_API_URL=/api/ VITE_APP_REPORTS_SERVER_URL=https://reports3.test.imex.online VITE_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc VITE_APP_INSTANCE=IMEX diff --git a/client/.env.development.promanager b/client/.env.development.promanager index 6935a24b3..00279809c 100644 --- a/client/.env.development.promanager +++ b/client/.env.development.promanager @@ -8,7 +8,7 @@ VITE_APP_CLOUDINARY_API_KEY=957865933348715 VITE_APP_CLOUDINARY_THUMB_TRANSFORMATIONS=c_fill,h_250,w_250 VITE_APP_FIREBASE_PUBLIC_VAPID_KEY='BG3tzU7L2BXlGZ_3VLK4PNaRceoEXEnmHfxcVbRMF5o5g05ejslhVPki9kBM9cBBT-08Ad9kN3HSpS6JmrWD6h4' VITE_APP_STRIPE_PUBLIC_KEY=pk_test_51GqB4TJl3nQjrZ0wCQWAxAhlNF8jKe0tipIa6ExBaxwJGitwvFsIZUEua4dUzaMIAuXp4qwYHXx7lgjyQSwP0Pe900vzm38C7g -VITE_APP_AXIOS_BASE_API_URL=https://localhost:4000 +VITE_APP_AXIOS_BASE_API_URL=/api/ VITE_APP_REPORTS_SERVER_URL=https://reports3.test.imex.online VITE_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc VITE_APP_INSTANCE=PROMANAGER diff --git a/client/.env.development.rome b/client/.env.development.rome index f05224847..e0805f439 100644 --- a/client/.env.development.rome +++ b/client/.env.development.rome @@ -9,7 +9,7 @@ VITE_APP_CLOUDINARY_API_KEY=957865933348715 VITE_APP_CLOUDINARY_THUMB_TRANSFORMATIONS=c_fill,h_250,w_250 VITE_APP_FIREBASE_PUBLIC_VAPID_KEY='BP1B7ZTYpn-KMt6nOxlld6aS8Skt3Q7ZLEqP0hAvGHxG4UojPYiXZ6kPlzZkUC5jH-EcWXomTLtmadAIxurfcHo' VITE_APP_STRIPE_PUBLIC_KEY=pk_test_51GqB4TJl3nQjrZ0wCQWAxAhlNF8jKe0tipIa6ExBaxwJGitwvFsIZUEua4dUzaMIAuXp4qwYHXx7lgjyQSwP0Pe900vzm38C7g -VITE_APP_AXIOS_BASE_API_URL=https://localhost:4000 +VITE_APP_AXIOS_BASE_API_URL=/api/ VITE_APP_REPORTS_SERVER_URL=https://reports3.test.imex.online VITE_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc VITE_APP_COUNTRY=USA diff --git a/client/src/pages/dms-payables/dms-payables.container.jsx b/client/src/pages/dms-payables/dms-payables.container.jsx index d00feddf3..f0c0e6c33 100644 --- a/client/src/pages/dms-payables/dms-payables.container.jsx +++ b/client/src/pages/dms-payables/dms-payables.container.jsx @@ -24,7 +24,7 @@ const mapDispatchToProps = (dispatch) => ({ export default connect(mapStateToProps, mapDispatchToProps)(DmsContainer); export const socket = SocketIO( - import.meta.env.PROD ? import.meta.env.VITE_APP_AXIOS_BASE_API_URL : window.location.origin, + import.meta.env.PROD ? import.meta.env.VITE_APP_AXIOS_BASE_API_URL : "https://localhost:3000", { path: "/ws", withCredentials: true, diff --git a/client/src/pages/dms/dms.container.jsx b/client/src/pages/dms/dms.container.jsx index 29acbf084..056ddf08e 100644 --- a/client/src/pages/dms/dms.container.jsx +++ b/client/src/pages/dms/dms.container.jsx @@ -34,7 +34,7 @@ const mapDispatchToProps = (dispatch) => ({ export default connect(mapStateToProps, mapDispatchToProps)(DmsContainer); export const socket = SocketIO( - import.meta.env.PROD ? import.meta.env.VITE_APP_AXIOS_BASE_API_URL : "https://localhost:4000", // for dev testing, + import.meta.env.PROD ? import.meta.env.VITE_APP_AXIOS_BASE_API_URL : "https://localhost:3000", // for dev testing, { path: "/ws", withCredentials: true, diff --git a/client/src/utils/CleanAxios.js b/client/src/utils/CleanAxios.js index 7d4d47c74..c7784d25d 100644 --- a/client/src/utils/CleanAxios.js +++ b/client/src/utils/CleanAxios.js @@ -4,7 +4,7 @@ import InstanceRenderManager from "./instanceRenderMgr"; axios.defaults.baseURL = import.meta.env.VITE_APP_AXIOS_BASE_API_URL || - (import.meta.env.MODE === "production" ? "https://api.imex.online/" : "https://localhost:4000/"); + (import.meta.env.MODE === "production" ? "https://api.imex.online/" : "/api/"); export const axiosAuthInterceptorId = axios.interceptors.request.use( async (config) => { diff --git a/client/vite.config.js b/client/vite.config.js index f50d678ab..0cb57d3c0 100644 --- a/client/vite.config.js +++ b/client/vite.config.js @@ -110,10 +110,24 @@ export default defineConfig({ proxy: { // Proxy for WebSocket server "/ws": { - target: "https://localhost:4000", + target: "http://localhost:4000", changeOrigin: true, secure: false, ws: true + }, + "/api": { + target: "http://localhost:4000", + changeOrigin: true, + secure: false, + ws: false, + rewrite: (path) => path.replace(/^\/api/, "") + }, + "/partner": { + target: "http://localhost:1337", + changeOrigin: true, + secure: false, + ws: false, + rewrite: (path) => path.replace(/^\/partner/, "") } }, https: { diff --git a/firebase/readme.md b/firebase/readme.md index 5dad97df9..c6015ae87 100644 --- a/firebase/readme.md +++ b/firebase/readme.md @@ -1,4 +1,4 @@ Must set the environment variables using: -firebase functions:config:set auth.graphql_endpoint="https://db.dev.bodyshop.app/v1/graphql" +firebase functions:config:set auth.graphql_endpoint="https://db.dev.imex.online/v1/graphql" auth.hasura_secret_admin_key="Dev-BodyShopApp!" diff --git a/server.js b/server.js index fe141093e..2eb415cf3 100644 --- a/server.js +++ b/server.js @@ -44,9 +44,7 @@ const SOCKETIO_CORS_ORIGIN = [ "https://www.test.promanager.web-est.com", "https://test.promanager.web-est.com", "https://www.promanager.web-est.com", - "https://www.promanager.web-est.com", - "http://localhost:3000", - "https://localhost:3000" + "https://www.promanager.web-est.com" ]; /** @@ -107,24 +105,9 @@ const main = async () => { let server; - if (process.env.NODE_ENV === "development") { - console.log("Setting up HTTPS for Development"); - // In development, run HTTPS server - const sslKeyPath = path.resolve(__dirname, "./certs/key.pem"); - const sslCertPath = path.resolve(__dirname, "./certs/cert.pem"); - - const httpsOptions = { - key: fs.readFileSync(sslKeyPath), - cert: fs.readFileSync(sslCertPath) - }; - - server = https.createServer(httpsOptions, app); - logger.log(`[${process.env.NODE_ENV}] HTTPS Server will run on port ${port}`, "INFO", "api"); - } else { - // In production or default, use HTTP - server = http.createServer(app); - logger.log(`[${process.env.NODE_ENV}] HTTP Server will run on port ${port}`, "INFO", "api"); - } + // In production or default, use HTTP + server = http.createServer(app); + logger.log(`[${process.env.NODE_ENV}] Attempting to start process on port ${port}`, "INFO", "api"); // Redis client setup for Pub/Sub and Key-Value Store const pubClient = createClient({ url: process.env.REDIS_URL || "redis://localhost:6379" }); @@ -135,7 +118,7 @@ const main = async () => { try { await Promise.all([pubClient.connect(), subClient.connect()]); - logger.log("Connected to Redis", "INFO", "redis"); + logger.log(`[${process.env.NODE_ENV}] Connected to Redis`, "INFO", "redis", "api"); } catch (redisError) { logger.log("Failed to connect to Redis", "ERROR", "redis", redisError); }