bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #62595] Add ability to read .env files into make and


From: Chigozirim Chukwu
Subject: [bug #62595] Add ability to read .env files into make and
Date: Wed, 8 Jun 2022 12:15:00 -0400 (EDT)

Follow-up Comment #2, bug #62595 (project make):

Hi Paul

.env files are commonly used for specifying secrets for an application or a
build.

Please see this question to get an idea of how people are currently trying to
use .env files in their Makefile:
https://unix.stackexchange.com/questions/235223/makefile-include-env-file

The format of a .env file is simply "key=value". From the make.env project I
linked to, here is what a typical file may look like

APP_PASSWORD='8oyy!r#vNpRy2TT'
FOO_BAR='4dabfs#a%d73w$Z2TBN4!nYD4Y$TW'
TEST_VAR='8X46Yj*aek3GQeiW7#bK!Eg@#6vjV'
ANOTHER_VAR='"hello world'

---

In the above case, the single quotes surrounding the value are to be ignored,
but everything else is to be taken literally. Some .env parsers take it a step
further and also expand environment variables within the .env file, so values
that are surrounded by double quotes and have $ symbol inside are expanded and
the result is what is stored as part of the value. ex. user="$USER" expands to
user="username".

The solution I settled on for the make.env project is to convert each of those
lines to "export KEY:='$(value VALUE)'", then load them into make using the
--eval flag. This was the only way I found that reliably loads the value into
make without make attempting to interpret the value.

I hope that clears things up


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?62595>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]