java-james / flutter_dotenv

Loads environment variables from `.env`.
https://pub.dartlang.org/packages/flutter_dotenv
MIT License
209 stars 46 forks source link

New environment variables aren't loaded if the browser has previously visited the site #49

Open BurningDog opened 2 years ago

BurningDog commented 2 years ago

I have a working site using a .env file. I added some new environment variables to the .env file and deployed, which resulted in a runtime error with flutter_sentry as it expected those environment variables to be present but they weren't.

However, in a new browser I had no runtime error.

After investigating I compared the contents of the deployed .env file with my local .env file and found out they did not match. This was because my browser (correctly) cached the .env file. I had to set up a new .env.1 file for a panicked quick production deploy to fix this (let's pretend for a second that this was not to a high traffic ecommerce site of a major international brand).

It should be included in the documentation in large, capital letters that the server MUST be configured to set a cache-control: none header on .env files otherwise new environment variables will not be loaded by Flutter.

Alternatively, this package should either:

sawirricardo commented 2 years ago

Any news on this? I'm facing this issue too

wackazong commented 2 years ago

Me too.