-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (39 loc) · 1.38 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
SWAGGER_SPEC_PATH=api/swagger
TEST_SMTP_SERVER_HTTP_PORT?=3000
include ./config/.env
export
.PHONY: run-compose
run-compose:
# docker does not support relative imports of env file so we create a symlink for .env
ln -sf ${PWD}/config/.env ./deploy/.env
docker compose -f ./deploy/docker-compose.yml up --build server
.PHONY: db-up
db-up:
docker compose -f ./deploy/docker-compose.yml up db -d
.PHONY: db-destroy
db-destroy:
docker compose -f ./deploy/docker-compose.yml stop db
docker compose -f ./deploy/docker-compose.yml rm -fv db
.PHONY: run-local-smtp-server
run-local-smtp-server:
# Env variables
# https://github.com/rnwood/smtp4dev/blob/master/docker-compose.yml
# https://github.com/rnwood/smtp4dev/blob/master/Rnwood.Smtp4dev/appsettings.json
docker run \
-d \
--rm \
--name smtp-server \
-e ServerOptions__HostName=${SMTP_HOST} \
-e RelayOptions__Login=${SMTP_USERNAME} \
-e RelayOptions__Password=${SMTP_PASSWORD} \
-p ${TEST_SMTP_SERVER_HTTP_PORT}:80 \
-p ${SMTP_PORT}:25 \
rnwood/smtp4dev:3.6.1
.PHONY: generate-swagger-spec
generate-swagger-spec:
swag init -generalInfo=app.go --dir=internal/app,internal/controllers --output=${SWAGGER_SPEC_PATH} --parseInternal --parseDependency
mkdir -p internal/controllers/swagger
mv ${SWAGGER_SPEC_PATH}/docs.go internal/controllers/swagger
.PHONY: format-api-annotations
format-api-annotations:
swag fmt internal/controllers