Search code examples
reactjsshopify-appshopify-apishopify-api-node

Using custom variables in .ENV using Shopify CLI


I'm using the Shopify CLI to create an app which allows me to use Shopify Serve.

Whenever you run Shopify Serve it automatically rewrites the .ENV file and removes any custom variables added. I'm trying to add a variable for MongoDB.

Can someone suggest a solution to either allow me to use the .ENV file to store the MongoDB details or an alternative solution?

Thanks!


Solution

  • Shopify server only update your ngrok url in your .env file you can write your MongoURL in .env file and shopify server command change nothing expect ngrok url use it in server.js as

    const mongoURL = process.env.MONGO_URL