Are you expecting the same .env configuration to work in production as in development - if yes, then you're missing the point of DotEnv; they should not be shared. Just set the correct and appropriate environment variables in production on the production server; and do not include them in your version control system.
How to set file path in .env?
I got a json file from a Google API service account thats in the root folder. The environment variable was set with full path to the file like so:
GOOGLE_APPLICATION_CREDENTIALS="C:/Users/marod/Desktop/text2speech/tapp/credentials.json"
It worked fine for now. But I know when I push to production it won't find the file.
So I tried doing it like:
GOOGLE_APPLICATION_CREDENTIALS="/tapp/credentials.json"
but it just gives error message:
"Google\ApiCore\ValidationException Could not construct ApplicationDefaultCredentials"
Is their better way to reference this file so that it always locates the json file even in production?
Any help would be appreciated.
Please or to participate in this conversation.