forked from mtusi2026/mtusi2026lab2
Начало реализации сервиса.
This commit is contained in:
@@ -3,8 +3,12 @@ BASE_URL ?= http://localhost:8080
|
||||
CA_FILE ?=
|
||||
ACTION_SCRIPT ?=
|
||||
TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",)
|
||||
OPENAPI_SPEC := contracts/openapi.json
|
||||
GEN_OUTPUT := service/internal/gen/contracts/types.gen.go
|
||||
GEN_PACKAGE := contracts
|
||||
OAPI_CODEGEN ?= $(shell go env GOPATH)/bin/oapi-codegen
|
||||
|
||||
.PHONY: help check validate test load test-persistence
|
||||
.PHONY: help check validate test load test-persistence openapi-generate certs key-gen
|
||||
|
||||
help:
|
||||
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
|
||||
@@ -24,3 +28,26 @@ load:
|
||||
test-persistence:
|
||||
@test -n "$(ACTION_SCRIPT)" || (echo "Set ACTION_SCRIPT to your implemented executable restart hook"; exit 2)
|
||||
$(PYTHON) tests/resilience.py --mode persistence --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS)
|
||||
|
||||
openapi-generate:
|
||||
@mkdir -p $(dir $(GEN_OUTPUT))
|
||||
@echo "Generating Go types from $(OPENAPI_SPEC)..."
|
||||
@set -o pipefail; \
|
||||
jq '(.components.schemas.ChatPage.properties.next_cursor.type, .components.schemas.MessagePage.properties.next_cursor.type) |= "string" | (.components.schemas.ChatPage.properties.next_cursor.nullable, .components.schemas.MessagePage.properties.next_cursor.nullable) = true' $(OPENAPI_SPEC) | \
|
||||
$(OAPI_CODEGEN) -generate types -package $(GEN_PACKAGE) -o $(GEN_OUTPUT) /dev/stdin
|
||||
|
||||
key-gen: create-dir gen-private-key gen-public-key
|
||||
|
||||
create-dir:
|
||||
@mkdir -p certs
|
||||
gen-private-key:
|
||||
@openssl genrsa -out certs/private_key.pem 2048
|
||||
gen-public-key:
|
||||
@openssl rsa -in certs/private_key.pem -pubout -outform PEM -out certs/public_key.pem
|
||||
|
||||
certs: gen-key gen-crt
|
||||
|
||||
gen-key:
|
||||
@openssl genrsa -out ./certs/server.key 2048
|
||||
gen-crt:
|
||||
@openssl req -new -x509 -key ./certs/server.key -out ./certs/server.crt -days 365
|
||||
|
||||
Reference in New Issue
Block a user