From a9dfce0ad4f286f1429b162429ea24c8a3fd203e Mon Sep 17 00:00:00 2001 From: Laurent Le Houerou Date: Mon, 25 Mar 2024 08:40:29 +0000 Subject: [PATCH] add basic makefile --- .gitignore | 1 + Makefile | 28 ++++++++++++++++++++++++++++ cmd/console/main.go | 4 ++-- 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 1d74e21..b5e9b0d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .vscode/ +.env diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d7f2ec4 --- /dev/null +++ b/Makefile @@ -0,0 +1,28 @@ + +BINARY_NAME=bin/sorare + +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/main.go + +run: build + @echo "Running..." + $(info JWTTOKEN is $(JWTTOKEN)) + $(info JWTAUDIENCE is $(JWTAUDIENCE)) + ./$(BINARY_NAME) --jwtaudience $(JWTAUDIENCE) --jwttoken $(JWTTOKEN) --verbose + +clean: + @echo "Cleaning..." + go clean + rm -f $(BINARY_NAME) + +.PHONY: build run clean ensure-bin-dir +.DEFAULT_GOAL := all +all: build run clean ensure-bin-dir diff --git a/cmd/console/main.go b/cmd/console/main.go index 9603143..6a343d4 100644 --- a/cmd/console/main.go +++ b/cmd/console/main.go @@ -13,8 +13,8 @@ import ( func main() { - token := os.Getenv("SORARE_TOKEN") - audience := os.Getenv("SORARE_AUDIENCE") + token := os.Getenv("JWTTOKEN") + audience := os.Getenv("JWTAUDIENCE") if token == "" { log.Fatal("No token provided") }