#3 fix: hardcoded urls

Closed
opened 5 months ago by fszontagh · 3 comments

For example in the issue #2 there is a summary. In the summary i found hard coded callback urls. (uninstallUri: 'https://shopcall-ai-backend.vercel.app/auth/shoprenter/uninstall')

Find more hard coded urls in the project, and replace with env variables. Update the documentations and example files too.

For example in the issue #2 there is a summary. In the summary i found hard coded callback urls. (uninstallUri: 'https://shopcall-ai-backend.vercel.app/auth/shoprenter/uninstall') Find more hard coded urls in the project, and replace with env variables. Update the documentations and example files too.
claude commented 5 months ago
Collaborator

🔍 Starting investigation of hardcoded URLs in the project.

I'll search through both frontend and backend repositories to identify all hardcoded URLs and replace them with environment variables.

Plan:

  1. Search for hardcoded URLs in backend (shopcall.ai-backend-main)
  2. Search for hardcoded URLs in frontend (shopcall.ai-main)
  3. Replace with environment variables
  4. Update documentation and example files
  5. Create .env.example files if needed

Starting the search now...

🔍 Starting investigation of hardcoded URLs in the project. I'll search through both frontend and backend repositories to identify all hardcoded URLs and replace them with environment variables. **Plan:** 1. Search for hardcoded URLs in backend (shopcall.ai-backend-main) 2. Search for hardcoded URLs in frontend (shopcall.ai-main) 3. Replace with environment variables 4. Update documentation and example files 5. Create .env.example files if needed Starting the search now...
claude commented 5 months ago
Collaborator

📊 Hardcoded URLs Found

I've completed a thorough scan of the project. Here's what I found:

Backend (shopcall.ai-backend-main/api/index.js)

Hardcoded Production URLs:

  1. Line 96-97: Shopify callback - https://shopcall-ai-backend.vercel.app/auth/shopify/callback
  2. Line 106: ShopRenter callback - https://shopcall-ai-backend.vercel.app/auth/shoprenter/callback
  3. Line 109: ShopRenter entry point - https://shopcall-ai-backend.vercel.app/auth/shoprenter
  4. Line 112: ShopRenter uninstall - https://shopcall-ai-backend.vercel.app/auth/shoprenter/uninstall
  5. Line 540: WooCommerce return URL - https://shopcall.ai/dashboard
  6. Line 541: WooCommerce callback - https://shopcall-ai-backend.vercel.app/auth/woocommerce/callback
  7. Line 769: ShopRenter redirect - https://shopcall.ai/dashboard?connection=success&platform=shoprenter
  8. Line 890: Shopify redirect - https://shopcall.ai/

Hardcoded Dev URLs:

  • Line 107, 110, 113: localhost:3000 URLs for development

Frontend (shopcall.ai-main)

Good news: The frontend already uses environment variables properly!

  • src/lib/config.ts uses VITE_API_URL with fallback
  • .env.example exists with proper documentation

Documentation Files

Multiple documentation files contain hardcoded URLs for reference purposes:

  • CLAUDE.md, README.md, DEPLOYMENT_GUIDE.md, SHOPRENTER.md, MISSING_FEATURES.md, etc.

🎯 Action Plan

  1. Create environment variables for backend:

    • BACKEND_URL - The backend base URL
    • FRONTEND_URL - The frontend base URL
  2. Update backend code to use these variables

  3. Create .env.example file for backend

  4. Update documentation to reflect the changes

  5. Test the changes to ensure OAuth flows still work

Proceeding with implementation now...

## 📊 Hardcoded URLs Found I've completed a thorough scan of the project. Here's what I found: ### Backend (`shopcall.ai-backend-main/api/index.js`) **Hardcoded Production URLs:** 1. Line 96-97: Shopify callback - `https://shopcall-ai-backend.vercel.app/auth/shopify/callback` 2. Line 106: ShopRenter callback - `https://shopcall-ai-backend.vercel.app/auth/shoprenter/callback` 3. Line 109: ShopRenter entry point - `https://shopcall-ai-backend.vercel.app/auth/shoprenter` 4. Line 112: ShopRenter uninstall - `https://shopcall-ai-backend.vercel.app/auth/shoprenter/uninstall` 5. Line 540: WooCommerce return URL - `https://shopcall.ai/dashboard` 6. Line 541: WooCommerce callback - `https://shopcall-ai-backend.vercel.app/auth/woocommerce/callback` 7. Line 769: ShopRenter redirect - `https://shopcall.ai/dashboard?connection=success&platform=shoprenter` 8. Line 890: Shopify redirect - `https://shopcall.ai/` **Hardcoded Dev URLs:** - Line 107, 110, 113: localhost:3000 URLs for development ### Frontend (`shopcall.ai-main`) ✅ **Good news:** The frontend already uses environment variables properly! - `src/lib/config.ts` uses `VITE_API_URL` with fallback - `.env.example` exists with proper documentation ### Documentation Files Multiple documentation files contain hardcoded URLs for reference purposes: - `CLAUDE.md`, `README.md`, `DEPLOYMENT_GUIDE.md`, `SHOPRENTER.md`, `MISSING_FEATURES.md`, etc. --- ## 🎯 Action Plan 1. **Create environment variables for backend:** - `BACKEND_URL` - The backend base URL - `FRONTEND_URL` - The frontend base URL 2. **Update backend code** to use these variables 3. **Create `.env.example` file** for backend 4. **Update documentation** to reflect the changes 5. **Test the changes** to ensure OAuth flows still work Proceeding with implementation now...
claude commented 5 months ago
Collaborator

✅ Issue Resolved

I've successfully replaced all hardcoded URLs with environment variables. Here's what was done:

🔧 Code Changes

1. Backend API (shopcall.ai-backend-main/api/index.js)

  • Added BACKEND_URL and FRONTEND_URL environment variable support
  • Replaced 8 hardcoded URLs with environment variables:
    • Shopify OAuth callback
    • ShopRenter OAuth callbacks, entry point, and uninstall URI
    • WooCommerce OAuth callbacks and return URL
    • All redirect URLs after successful authentication

2. Environment Configuration

  • Created .env.example file for backend with all required variables
  • Added intelligent defaults that automatically select appropriate URLs based on NODE_ENV

📚 Documentation Updates

1. CLAUDE.md

  • Updated environment configuration section with new variables
  • Added notes about URL configurability
  • Updated deployment instructions

2. DEPLOYMENT_GUIDE.md

  • Added new section for Vercel backend deployment
  • Documented all required environment variables
  • Emphasized importance of setting these in production

3. SHOPRENTER.md

  • Added note about configurable URLs at the technical endpoints section
  • Referenced .env.example for configuration details

🎯 Key Benefits

  1. Flexible Deployment - Can now deploy to any domain without code changes
  2. Multiple Environments - Easy to configure dev, staging, and production
  3. Security - Sensitive URLs can be kept out of version control
  4. Maintainability - Single source of truth for all URLs

📝 Required Actions for Deployment

When deploying, ensure these environment variables are set:

Backend (Vercel):

  • BACKEND_URL - Your backend URL (e.g., https://api.yourdomain.com)
  • FRONTEND_URL - Your frontend URL (e.g., https://yourdomain.com)

Frontend (Vercel):

  • VITE_API_URL - Backend API URL
  • VITE_FRONTEND_URL - Frontend URL

📦 Commit Details

Commit: b0f7af4

  • 5 files changed
  • 110 insertions, 24 deletions
  • All changes committed and pushed to main branch

The issue is now resolved and ready for testing!

## ✅ Issue Resolved I've successfully replaced all hardcoded URLs with environment variables. Here's what was done: ### 🔧 Code Changes **1. Backend API (`shopcall.ai-backend-main/api/index.js`)** - Added `BACKEND_URL` and `FRONTEND_URL` environment variable support - Replaced 8 hardcoded URLs with environment variables: - Shopify OAuth callback - ShopRenter OAuth callbacks, entry point, and uninstall URI - WooCommerce OAuth callbacks and return URL - All redirect URLs after successful authentication **2. Environment Configuration** - Created `.env.example` file for backend with all required variables - Added intelligent defaults that automatically select appropriate URLs based on `NODE_ENV` ### 📚 Documentation Updates **1. CLAUDE.md** - Updated environment configuration section with new variables - Added notes about URL configurability - Updated deployment instructions **2. DEPLOYMENT_GUIDE.md** - Added new section for Vercel backend deployment - Documented all required environment variables - Emphasized importance of setting these in production **3. SHOPRENTER.md** - Added note about configurable URLs at the technical endpoints section - Referenced `.env.example` for configuration details ### 🎯 Key Benefits 1. **Flexible Deployment** - Can now deploy to any domain without code changes 2. **Multiple Environments** - Easy to configure dev, staging, and production 3. **Security** - Sensitive URLs can be kept out of version control 4. **Maintainability** - Single source of truth for all URLs ### 📝 Required Actions for Deployment When deploying, ensure these environment variables are set: **Backend (Vercel):** - `BACKEND_URL` - Your backend URL (e.g., `https://api.yourdomain.com`) - `FRONTEND_URL` - Your frontend URL (e.g., `https://yourdomain.com`) **Frontend (Vercel):** - `VITE_API_URL` - Backend API URL - `VITE_FRONTEND_URL` - Frontend URL ### 📦 Commit Details Commit: `b0f7af4` - 5 files changed - 110 insertions, 24 deletions - All changes committed and pushed to main branch The issue is now resolved and ready for testing!
Sign in to join this conversation.
No Milestone
No assignee
2 Participants
Loading...
Cancel
Save
There is no content yet.