diff --git a/examples/fullstack/Makefile b/examples/fullstack/Makefile index 58580b6..47ced44 100644 --- a/examples/fullstack/Makefile +++ b/examples/fullstack/Makefile @@ -3,7 +3,6 @@ SRC = $(wildcard *.go) GO = $(shell which go) DOTENV = .env --include $(DOTENV) TEMPLATE_SRC = $(shell find templates -type f) STATIC_SRC = $(shell find static -type f) @@ -27,13 +26,15 @@ $(STATIC_DST): $(STATIC_SRC) scripts/minify.go @$(GO) run scripts/minify.go -src=static -dst=$(STATIC_DST) @touch $@ -run: $(BIN) - @PRODUCTION=${PRODUCTION} \ - PORT=${PORT} \ - APP_DATA_DIR=${APP_DATA_DIR} \ - DB_CONNDVR=${DB_CONNDVR} \ - DB_CONNSTR=${DB_CONNSTR} \ - ./$(BIN) +run: $(BIN) $(DOTENV) datadir + @env $(shell cat $(DOTENV) | xargs) ./$(BIN) + +$(DOTENV): + @cp .env.example $@ + +datadir: $(DOTENV) + @APP_DATA_DIR=$$(grep '^APP_DATA_DIR=' $(DOTENV) | cut -d '=' -f2); \ + if [ -n "$$APP_DATA_DIR" ]; then mkdir -p "$$APP_DATA_DIR"; fi clean: @echo "🧹 Cleaning..."