Using env variables in Javascript with different local/production values

Posted 1 year ago by lmartins

I'm working on a application that is connected to Algolia. Because I'm working locally with test data, I need to connect my local install to a different Algolia index, so I'm using .env variable to set different keys for my local and remote installs. Then, in Javascript, I'm reading those values using process.env.MIX_ALGOLIA_APP_ID which sadly isn't enough as these values will still be compiled using my local values when running npm prod. How do you typically approach this? Thanks!

Please sign in or create an account to participate in this conversation.