34 lines
1.1 KiB
Makefile
34 lines
1.1 KiB
Makefile
# Go parameters
|
|
GOCMD=go
|
|
GOBUILD=$(GOCMD) build
|
|
GOCLEAN=$(GOCMD) clean
|
|
GOTEST=$(GOCMD) test
|
|
GOGET=$(GOCMD) get
|
|
LD_OPTS_STATIC=-ldflags "-s -w -extldflags '-static'"
|
|
BINARY_NAME=notification-telegram
|
|
|
|
clean:
|
|
@$(RM) "$(BINARY_NAME)"
|
|
|
|
build: clean
|
|
$(GOBUILD) $(LD_OPTS_STATIC) -o $(BINARY_NAME) -a -tags netgo
|
|
|
|
deploy: build
|
|
cp $(BINARY_NAME) /usr/local/lib/crowdsec/plugins/
|
|
chown root:root /usr/local/lib/crowdsec/plugins/$(BINARY_NAME)
|
|
systemctl restart crowdsec
|
|
|
|
docker-deploy: build
|
|
docker cp $(BINARY_NAME) crowdsec:/usr/local/lib/crowdsec/plugins/
|
|
docker exec crowdsec chown root:root /usr/local/lib/crowdsec/plugins/$(BINARY_NAME)
|
|
docker restart crowdsec
|
|
|
|
test: deploy
|
|
while ! cscli decisions delete --ip 1.2.3.4 --debug; do continue; done
|
|
cscli decisions add --ip 1.2.3.4 --debug
|
|
cscli decisions delete --ip 1.2.3.4 --debug
|
|
|
|
docker-test: docker-deploy
|
|
while ! docker exec crowdsec cscli decisions delete --ip 1.2.3.4 --debug; do continue; done
|
|
docker exec crowdsec cscli decisions add --ip 1.2.3.4 --debug
|
|
docker exec crowdsec cscli decisions delete --ip 1.2.3.4 --debug
|