Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ help:
@printf " $(BOLD)$(GREEN)fresh$(NC) : Clean and reset various project components (logs, build, etc.).\n"
@printf " $(BOLD)$(GREEN)audit$(NC) : Run code audits and checks.\n"
@printf " $(BOLD)$(GREEN)watch$(NC) : Start a file watcher process.\n"
@printf " $(BOLD)$(GREEN)format$(NC) : Automatically format code.\n\n"
@printf " $(BOLD)$(GREEN)format$(NC) : Automatically format code.\n"
@printf " $(BOLD)$(GREEN)run-cli$(NC) : Run the API's cli interface.\n\n"

@printf "$(BOLD)$(BLUE)Build Commands:$(NC)\n"
@printf " $(BOLD)$(GREEN)build-local$(NC) : Build the main application for development.\n"
Expand Down
20 changes: 19 additions & 1 deletion config/makefile/app.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: fresh audit watch format
.PHONY: fresh audit watch format run-cli

format:
gofmt -w -s .
Expand Down Expand Up @@ -30,3 +30,21 @@ install-air:
# https://github.com/air-verse/air
@echo "Installing air ..."
@go install github.com/air-verse/air@latest

run-cli:
@if [ -z "$(DB_SECRET_USERNAME)" ] || [ -z "$(DB_SECRET_PASSWORD)" ] || [ -z "$(DB_SECRET_DBNAME)" ]; then \
printf "\n$(RED)⚠️ Usage: make run-cli \n$(NC)"; \
printf " DB_SECRET_USERNAME=/path/to/pg_username\n"; \
printf " DB_SECRET_PASSWORD=/path/to/pg_password\n"; \
printf " DB_SECRET_DBNAME=/path/to/pg_dbname\n\n"; \
printf "\n------------------------------------------------------\n\n"; \
exit 1; \
fi; \
printf "\n$(GREEN)🔒 Running CLI with secrets from:$(NC)\n"; \
printf " DB_SECRET_USERNAME=$(DB_SECRET_USERNAME)\n"; \
printf " DB_SECRET_PASSWORD=$(DB_SECRET_PASSWORD)\n"; \
printf " DB_SECRET_DBNAME=$(DB_SECRET_DBNAME)\n\n"; \
DB_SECRET_USERNAME="$(DB_SECRET_USERNAME)" \
DB_SECRET_PASSWORD="$(DB_SECRET_PASSWORD)" \
DB_SECRET_DBNAME="$(DB_SECRET_DBNAME)" \
docker compose run --rm api-runner go run $(ROOT_PATH)/cli/main.go
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,12 @@ services:
image: golang:1.24-alpine
volumes:
- .:/app
- ./.env:/.env:ro
- go_mod_cache:/go/pkg/mod
working_dir: /app
environment:
ENV_DB_HOST: api-db
ENV_DB_PORT: ${ENV_DB_PORT:-5432}
networks:
- oullin_net
secrets:
Expand Down
Loading