krakend/Makefile
2020-10-15 17:36:15 +02:00

50 lines
1.5 KiB
Makefile

.PHONY: help
.DEFAULT_GOAL := help
# Uppercase vars for internal use.
UC = $(shell echo '$1' | tr '[:lower:]' '[:upper:]')
LOG_ERROR = @printf "\n>> \e[0;31m$1\e[0;00m\n\n"
LOG_WARN = @printf "\n>> \e[0;33m$1\e[0;00m\n\n"
LOG_INFO = @printf "\n>> \e[0;34m$1\e[0;00m\n\n"
LOG_SUCCESS = @printf "\n>> \e[0;36m$1\e[0;00m\n\n"
LOG_SUBLINE = @printf " \e[0;34m$1\e[0;00m\n\n"
HYDRA_COMMAND = docker-compose -p kraken -f docker-compose.yml exec hydra
help:
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-10s\033[0m %s\n", $$1, $$2}'
up: ## Docker: start compose stack
$(call LOG_INFO,Up (daemon))
docker-compose -p kraken up -d
stop: ## Docker: stop compose stack
$(call LOG_INFO,Stop docker stack)
docker-compose -p kraken stop
ps: ## Docker: show containers
$(call LOG_INFO, Docker containers)
docker-compose -p kraken ps
logs: ## Docker: show logs
docker-compose -p kraken logs -f
generate_keys: ## Generowanie kluczy klienckich
${HYDRA_COMMAND} hydra clients create \
--endpoint http://127.0.0.1:4445 \
--id auth-code-client \
--secret secret \
--grant-types authorization_code,refresh_token \
--response-types code,id_token \
--scope openid,offline \
--callbacks http://127.0.0.1:5555/callback
token_flow: ## Generowanie kluczy klienckich
${HYDRA_COMMAND} hydra token user \
--client-id auth-code-client \
--client-secret secret \
--endpoint http://127.0.0.1:4444/ \
--port 5555 \
--scope openid,offline