2024-03-21 06:33:44 +00:00
|
|
|
BINARY_NAME=bin/sorarebuddy
|
|
|
|
|
|
|
|
BIN_DIR=$(shell dirname $(BINARY_NAME))
|
|
|
|
include .env
|
|
|
|
export $(shell sed 's/=.*//' .env)
|
|
|
|
|
|
|
|
ensure-bin-dir:
|
|
|
|
@mkdir -p $(BIN_DIR)
|
|
|
|
|
|
|
|
build: ensure-bin-dir
|
|
|
|
@echo "Building..."
|
|
|
|
go build -o $(BINARY_NAME) cmd/console/root.go
|
|
|
|
|
|
|
|
run: build
|
|
|
|
@echo "Running..."
|
|
|
|
$(info JWTTOKEN is $(JWTTOKEN))
|
|
|
|
$(info JWTAUDIENCE is $(JWTAUDIENCE))
|
|
|
|
./$(BINARY_NAME) --jwtaudience $(JWTAUDIENCE) --jwttoken $(JWTTOKEN) --dbhost $(DBHOST) --dbport $(DBPORT) --dbuser $(DBUSER) --dbpass $(DBPASS) --dbname $(DBNAME) --verbose
|
|
|
|
|
|
|
|
clean:
|
|
|
|
@echo "Cleaning..."
|
|
|
|
go clean
|
|
|
|
rm -f $(BINARY_NAME)
|
|
|
|
|
2024-03-21 17:56:06 +00:00
|
|
|
downdb:
|
2024-03-21 06:33:44 +00:00
|
|
|
goose -dir ./db/migrations postgres "host=$(DBHOST) port=$(DBPORT) user=$(DBUSER) password=$(DBPASS) dbname=$(DBNAME) sslmode=disable" down
|
2024-03-21 17:56:06 +00:00
|
|
|
|
|
|
|
updb:
|
2024-03-21 06:33:44 +00:00
|
|
|
goose -dir ./db/migrations postgres "host=$(DBHOST) port=$(DBPORT) user=$(DBUSER) password=$(DBPASS) dbname=$(DBNAME) sslmode=disable" up
|
|
|
|
|
2024-03-21 17:56:06 +00:00
|
|
|
resetdb:
|
|
|
|
make downdb
|
|
|
|
make updb
|
|
|
|
|
|
|
|
.PHONY: build run clean ensure-bin-dir resetdb downdb updb
|
2024-03-21 06:33:44 +00:00
|
|
|
.DEFAULT_GOAL := all
|
|
|
|
all: build run clean ensure-bin-dir
|
|
|
|
|