joho / godotenv

A Go port of Ruby's dotenv library (Loads environment variables from .env files)
http://godoc.org/github.com/joho/godotenv
MIT License
8.49k stars 405 forks source link

Add LoadFromString function to load environment variables from a string #208

Closed c3rtificate closed 1 year ago

c3rtificate commented 1 year ago

This commit adds a new function called LoadFromString, which allows users to load environment variables from a string rather than from a file. This can be useful in scenarios where the .env file is not available, such as when the application is deployed to a cloud environment. The function takes a string containing environment variable assignments and a flag indicating whether to override existing variables, and then adds those variables to the process environment. The function is fully documented.