File tree Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 5252 @printf " $(BOLD)$(GREEN)fresh$(NC) : Clean and reset various project components (logs, build, etc.).\n"
5353 @printf " $(BOLD)$(GREEN)audit$(NC) : Run code audits and checks.\n"
5454 @printf " $(BOLD)$(GREEN)watch$(NC) : Start a file watcher process.\n"
55- @printf " $(BOLD)$(GREEN)format$(NC) : Automatically format code.\n\n"
55+ @printf " $(BOLD)$(GREEN)format$(NC) : Automatically format code.\n"
56+ @printf " $(BOLD)$(GREEN)run-cli$(NC) : Run the API's cli interface.\n\n"
5657
5758 @printf "$(BOLD)$(BLUE)Build Commands:$(NC)\n"
5859 @printf " $(BOLD)$(GREEN)build-local$(NC) : Build the main application for development.\n"
Original file line number Diff line number Diff line change 1- .PHONY : fresh audit watch format
1+ .PHONY : fresh audit watch format run-cli
22
33format :
44 gofmt -w -s .
@@ -30,3 +30,21 @@ install-air:
3030 # https://github.com/air-verse/air
3131 @echo " Installing air ..."
3232 @go install github.com/air-verse/air@latest
33+
34+ run-cli :
35+ @if [ -z " $( DB_SECRET_USERNAME) " ] || [ -z " $( DB_SECRET_PASSWORD) " ] || [ -z " $( DB_SECRET_DBNAME) " ]; then \
36+ printf "\n$(RED ) ⚠️ Usage : make run-cli \n$(NC ) "; \
37+ printf " DB_SECRET_USERNAME=/path/to/pg_username\n"; \
38+ printf " DB_SECRET_PASSWORD=/path/to/pg_password\n"; \
39+ printf " DB_SECRET_DBNAME=/path/to/pg_dbname\n\n"; \
40+ printf "\n------------------------------------------------------\n\n"; \
41+ exit 1; \
42+ fi; \
43+ printf "\n$(GREEN ) 🔒 Running CLI with secrets from :$(NC ) \n"; \
44+ printf " DB_SECRET_USERNAME=$(DB_SECRET_USERNAME)\n"; \
45+ printf " DB_SECRET_PASSWORD=$(DB_SECRET_PASSWORD)\n"; \
46+ printf " DB_SECRET_DBNAME=$(DB_SECRET_DBNAME)\n\n"; \
47+ DB_SECRET_USERNAME="$(DB_SECRET_USERNAME)" \
48+ DB_SECRET_PASSWORD="$(DB_SECRET_PASSWORD)" \
49+ DB_SECRET_DBNAME="$(DB_SECRET_DBNAME)" \
50+ docker compose run --rm api-runner go run $(ROOT_PATH)/cli/main.go
Original file line number Diff line number Diff line change @@ -80,8 +80,12 @@ services:
8080 image : golang:1.24-alpine
8181 volumes :
8282 - .:/app
83+ - ./.env:/.env:ro
8384 - go_mod_cache:/go/pkg/mod
8485 working_dir : /app
86+ environment :
87+ ENV_DB_HOST : api-db
88+ ENV_DB_PORT : ${ENV_DB_PORT:-5432}
8589 networks :
8690 - oullin_net
8791 secrets :
You can’t perform that action at this time.
0 commit comments