GoogleCloudPlatform / functions-framework

The Contract for Building New Function Frameworks
Apache License 2.0
120 stars 12 forks source link

Support and respect .env file for loading environment variables in local development #43

Closed greg76 closed 3 years ago

greg76 commented 3 years ago

During local development it would be a great help if running functions_framework would load environment variables from the dotenv file, just as flask does. This would streamline the development process.

grant commented 3 years ago

Hi @greg76, I'm not sure if everybody wants their functions to load a file before development. With local dev, you can just call a 1-2 line function in most languages like:

from dotenv import load_dotenv
load_dotenv()

Or load an env file in your shell:

https://stackoverflow.com/questions/19331497/set-environment-variables-from-file-of-key-value-pairs

Do you have a more concrete proposal? Or existing pain? I can't tell.

grant commented 3 years ago

Given it's relatively simple to load env files in your function, and there's no reply here, I'm closing the issue. Thanks!