godotenv icon indicating copy to clipboard operation
godotenv copied to clipboard

Added global substitutions support

Open arsoba opened this issue 6 years ago • 5 comments

Hi, I've added support for substitutions for global env vars.

arsoba avatar Feb 26 '19 08:02 arsoba

@joho ping?

davidkarlsen avatar Oct 08 '19 15:10 davidkarlsen

@arsoba PTAL?

davidkarlsen avatar Nov 01 '19 08:11 davidkarlsen

Seconding the need for this fix.

I also notice a slight tweak that I'd consider necessary: this fix does not work intuitively with the Overload() vs. Load() paradigm: Load() will not override variables defined previously in the file, but will override those inherited from os environment. The overload flag would have to be propagated to expandVariables() and the os/file value returned accordingly where this fix was made.

ebudan avatar Feb 11 '20 16:02 ebudan

Just FYI yesterday I created issue #102 and then implemented https://github.com/joho/godotenv/pull/103/files which holds the same feature here but already considering the comment @ebudan added, passing through the overload flag to the expansion function.

fabriciojs avatar May 26 '20 17:05 fabriciojs

@ebudan @fabriciojs I don't think we need to care about load vs overload here, that's handled after in the loadFile function.

@joho why is a custom function needed for expanding variables? Why not just use os.ExpandEnv? If the reason is to support the $(VAR) format, I think there's a (\))? missing at the end of the regex.

luisdavim avatar May 14 '22 23:05 luisdavim