mirror of
https://github.com/Forceu/Gokapi.git
synced 2025-12-30 05:19:34 -06:00
* Require 1.9.6 for upgrade, add function to get userID from request * Automatically add user when successfully authenticated with headers / oauth, disallow modifing own user permissions * Dont show user/pw page when using header authentication * Only display redacted versions of API keys #228, fixed deployment password * Added animation for deleting API key * Only create salt once * Disable elements on upload UI if insufficient permissions * BREAKING: User field must be email for OAUTH2, added warning in setup when changing database * BREAKING: Added option to restrict to only registered users * Fixed crash due to concurrent map iteration * Replace /uploadComplete with API call, BREAKING API is now in headers * BREAKING: require true|false instead of only checking for true * BREAKING API: Renamed apiKeyToModify parameter to targetKey
82 lines
2.5 KiB
Makefile
82 lines
2.5 KiB
Makefile
GOPACKAGE=github.com/forceu/gokapi
|
|
BUILD_FLAGS=-ldflags="-s -w -X '$(GOPACKAGE)/internal/environment.Builder=Make Script' -X '$(GOPACKAGE)/internal/environment.BuildTime=$(shell date)'"
|
|
BUILD_FLAGS_DEBUG=-ldflags="-X '$(GOPACKAGE)/internal/environment.Builder=Make Script' -X '$(GOPACKAGE)/internal/environment.BuildTime=$(shell date)'"
|
|
DOCKER_IMAGE_NAME=gokapi
|
|
CONTAINER_TOOL ?= docker
|
|
|
|
# Default target
|
|
.PHONY: all
|
|
all: build
|
|
|
|
|
|
.PHONY: build
|
|
# Build Gokapi binary
|
|
build :
|
|
@echo "Building binary..."
|
|
@echo
|
|
go generate ./...
|
|
CGO_ENABLED=0 go build $(BUILD_FLAGS) -o ./gokapi $(GOPACKAGE)/cmd/gokapi
|
|
|
|
.PHONY: build-debug
|
|
# Build Gokapi binary
|
|
build-debug :
|
|
@echo "Building binary with debug info..."
|
|
@echo
|
|
go generate ./...
|
|
CGO_ENABLED=0 go build $(BUILD_FLAGS_DEBUG) -o ./gokapi $(GOPACKAGE)/cmd/gokapi
|
|
|
|
.PHONY: coverage
|
|
coverage:
|
|
@echo Generating coverage
|
|
@echo
|
|
GOKAPI_AWS_BUCKET="gokapi" GOKAPI_AWS_REGION="eu-central-1" GOKAPI_AWS_KEY="keyid" GOKAPI_AWS_KEY_SECRET="secret" go test ./... -parallel 8 --tags=test,awstest -coverprofile=/tmp/coverage1.out && go tool cover -html=/tmp/coverage1.out
|
|
|
|
.PHONY: coverage-specific
|
|
coverage-specific:
|
|
@echo Generating coverage for "$(TEST_PACKAGE)"
|
|
@echo
|
|
go test $(GOPACKAGE)/$(TEST_PACKAGE)/... -parallel 8 --tags=test,awsmock -coverprofile=/tmp/coverage2.out && go tool cover -html=/tmp/coverage2.out
|
|
|
|
|
|
.PHONY: coverage-all
|
|
coverage-all:
|
|
@echo Generating coverage
|
|
@echo
|
|
GOKAPI_AWS_BUCKET="gokapi" GOKAPI_AWS_REGION="eu-central-1" GOKAPI_AWS_KEY="keyid" GOKAPI_AWS_KEY_SECRET="secret" go test ./... -parallel 8 --tags=test,awstest -coverprofile=/tmp/coverage1.out && go tool cover -html=/tmp/coverage1.out
|
|
|
|
|
|
.PHONY: test
|
|
test:
|
|
@echo Testing with AWS mock
|
|
@echo
|
|
go test ./... -parallel 8 --tags=test,awsmock
|
|
|
|
|
|
.PHONY: test-specific
|
|
test-specific:
|
|
@echo Testing package "$(TEST_PACKAGE)"
|
|
@echo
|
|
go test $(GOPACKAGE)/$(TEST_PACKAGE)/... -parallel 8 -count=1 --tags=test,awsmock
|
|
|
|
|
|
.PHONY: test-all
|
|
test-all:
|
|
@echo Testing all tags
|
|
@echo
|
|
go test ./... -parallel 8 --tags=test,noaws
|
|
go test ./... -parallel 8 --tags=test,awsmock
|
|
GOKAPI_AWS_BUCKET="gokapi" GOKAPI_AWS_REGION="eu-central-1" GOKAPI_AWS_KEY="keyid" GOKAPI_AWS_KEY_SECRET="secret" go test ./... -parallel 8 --tags=test,awstest
|
|
|
|
.PHONY: clean
|
|
# Deletes binary
|
|
clean:
|
|
@echo "Cleaning up..."
|
|
rm -f $(OUTPUT_BIN)
|
|
|
|
.PHONY: docker-build
|
|
# Create a Docker image
|
|
# Use make docker-build CONTAINER_TOOL=podman for podman instead of Docker
|
|
docker-build: build
|
|
@echo "Building container image..."
|
|
$(CONTAINER_TOOL) build . -t $(DOCKER_IMAGE_NAME)
|