tenseleyflow/shithub / e642477

Browse files

dev: makefile dev/dev-migrate/dev-run targets that source .env

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
e64247723f3b2893c4f4b495ab9d74ae10acdb56
Parents
c4e5c9c
Tree
dbc86d8

1 changed file

StatusFile+-
M Makefile 10 2
Makefilemodified
@@ -28,8 +28,16 @@ AIR := $(GOBIN)/air
28
 help: ## Show this help.
28
 help: ## Show this help.
29
 	@awk 'BEGIN {FS = ":.*##"} /^[a-zA-Z_-]+:.*##/ {printf "  %-20s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
29
 	@awk 'BEGIN {FS = ":.*##"} /^[a-zA-Z_-]+:.*##/ {printf "  %-20s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
30
 
30
 
31
-dev: ## Run the web server with hot reload via air.
31
+dev: ## Run the web server with hot reload via air. Sources .env if present.
32
-	@$(AIR)
32
+	@if [ -f .env ]; then set -a; . ./.env; set +a; fi; $(AIR)
33
+
34
+dev-migrate: ## Apply DB migrations against $$SHITHUB_DATABASE_URL (sources .env).
35
+	@if [ -f .env ]; then set -a; . ./.env; set +a; fi; \
36
+	go run ./cmd/shithubd migrate up
37
+
38
+dev-run: ## Run the binary directly (no air); sources .env.
39
+	@if [ -f .env ]; then set -a; . ./.env; set +a; fi; \
40
+	go run ./cmd/shithubd web
33
 
41
 
34
 build: ## Build the shithubd binary into bin/.
42
 build: ## Build the shithubd binary into bin/.
35
 	@mkdir -p bin
43
 	@mkdir -p bin