Infuses GNU make with the ability to read .env files
Project description
make.env
Infuses GNU make with the ability to read .env files
Motivation
Often when working with Makefiles, you might have the need to read environment variables from a .env
file, and have make
treat them as if the environment variables were actually variables in the Makefile.
The most popular solution is to import the .env
file into the Makefile, and then export every varaible declared so far:
include .env
export
The problem with this is that it is prone to errors. For example, if your .env
file contains the following:
APP_PASSWORD='8oyy!r#vNpRy2TT'
The variable APP_PASSWORD
will be exported with the value '8oyy!r
. Likewise, if your .env
file contains the following:
APP_PASSWORD='Qy%$%J9$rD#jqVw'
The variable APP_PASSWORD
will be exported with the value 'Qy%J9D
.
What's more, any attempt to use this variable will result in an error in make
concerning the lack of a closing quote:
unexpected EOF while looking for matching `''
Explanaition
In both cases, APP_PASSWORD
contained values which make
treats specially.
The #
is used to start comments, therefore as soon as make sees a #
, it will ignore the rest of the line.
The $
is used to reference a variable or function, so when make sees a $
, it will treat whatever comes after it as a variable or function reference.
The solution
That's where this wrapper comes in. It allows us to read a .env
file and pass them to make
in a way that allows make
to treat them as variables and copy their values literally rather than attempting to interpret them.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file make.env-0.0.7.tar.gz
.
File metadata
- Download URL: make.env-0.0.7.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.10.2 Linux/5.11.0-1028-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | af6f544887db0c8c0cd0866ba6087974a27ac66d69486f403efcc1dcc9a43791 |
|
MD5 | b39075926d0900c79f9b143778af5e2b |
|
BLAKE2b-256 | 7cf2896c05f82e66cec079d1572893773fa483b03c6453d72b3072c5b49afcd1 |
File details
Details for the file make.env-0.0.7-py3-none-any.whl
.
File metadata
- Download URL: make.env-0.0.7-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.10.2 Linux/5.11.0-1028-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d4dc6e4189b1d500120f9cbf7b0e7842a66cb5a3d35853bd181c7f7f843fd00 |
|
MD5 | 0f2e5593eb470e92b683e7c826fa9db9 |
|
BLAKE2b-256 | 9962bf7a5403e882d6b849ce35c36810b01bfb07338b578ce7eb10dea5ff7ca7 |