What is the correct method to deploy a Laravel/Vue application using Forge with MIX local/production environment variables

Viewed 578

I understand the process of local > staging > production deployment, although I've come across one issue which I have a solution, but it doesn't feel like it's the correct method.

I have a production .env on the server and a local .env for local development which is all fine for storing my environment variables. Although, I am using Stripe API and have testing API keys locally and live API keys for production.

My Stripe public key gets pulled into public.app.js the Vue/Inertia compilation using the MIX_ prefix in my .env. I first push this to GitHub and then Deploy this to Laravel Forge where in my deploy script it runs yarn prod, pulling in the live Stripe public API key once compiled by the server.

Basically, what I am asking is: Is there a standard deployment process where you compile production ready files locally pulling the correct API keys and push to GitHub, or is there a better way which removes the need of compiling assets on the server?

0 Answers
Related