Skip to content

Commit e59a249

Browse files
fix(Makefile): don't export DATABASE_URL from .env
Kept running into issues where if I tried to compile the project from the Makefile I would get a bunch of errors from SQLx but if I ran the exact same commands in the shell it would be fine. Apparently the problem was that SQLx expects the DATABASE_URL var to be a regular shell variable, which it's not if it's exported by Make. The fix is to not export the Make var and now everything works.
1 parent 444ed8e commit e59a249

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
ifneq (,$(wildcard ./.env))
22
include .env
33
export
4+
unexport DATABASE_URL # Exporting this causes sqlx to fail during compilation
45
endif
56

67
BUILD_DIR="target/x86_64-unknown-linux-gnu/release"
78
BIN_NAME="jonathansm"
89

910
.PHONY: all pi mac test clean deploy
1011

11-
all: pi mac
12+
all: linux mac
1213

13-
pi:
14+
linux:
1415
cargo build --release --target=x86_64-unknown-linux-gnu
1516

1617
mac:

0 commit comments

Comments
 (0)