add basic makefile
This commit is contained in:
parent
c3a9b25af4
commit
a9dfce0ad4
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
.vscode/
|
.vscode/
|
||||||
|
.env
|
||||||
|
28
Makefile
Normal file
28
Makefile
Normal file
@ -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
|
@ -13,8 +13,8 @@ import (
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
token := os.Getenv("SORARE_TOKEN")
|
token := os.Getenv("JWTTOKEN")
|
||||||
audience := os.Getenv("SORARE_AUDIENCE")
|
audience := os.Getenv("JWTAUDIENCE")
|
||||||
if token == "" {
|
if token == "" {
|
||||||
log.Fatal("No token provided")
|
log.Fatal("No token provided")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user