Skip to content
Closed
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 .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/bin
/dist
/coverage
/cmd/server/cache_data
/cmd/server/cache_data
.env
4 changes: 2 additions & 2 deletions docs/docs.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// Package docs GENERATED BY SWAG; DO NOT EDIT
// This file was generated by swaggo/swag
package docs

Expand Down Expand Up @@ -34,7 +34,7 @@ const docTemplate = `{
"application/json"
],
"tags": [
"Campaigns"
"Activate"
],
"summary": "Activate a campaign",
"operationId": "activate",
Expand Down
2 changes: 1 addition & 1 deletion docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"application/json"
],
"tags": [
"Campaigns"
"Activate"
],
"summary": "Activate a campaign",
"operationId": "activate",
Expand Down
2 changes: 1 addition & 1 deletion docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ paths:
$ref: '#/definitions/handlers.errorMessage'
summary: Activate a campaign
tags:
- Campaigns
- Activate
/campaigns:
post:
consumes:
Expand Down
76 changes: 76 additions & 0 deletions examples/advanced_features_demo/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
.PHONY: help run setup start-infra stop-infra clean test

help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Available targets:'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-15s %s\n", $$1, $$2}' $(MAKEFILE_LIST)

setup: ## Copy .env.example to .env (edit with your credentials)
@if [ ! -f .env ]; then \
cp .env.example .env; \
echo "✓ Created .env file - please edit with your credentials"; \
else \
echo "✓ .env file already exists"; \
fi

start-infra: ## Start Redis and Decision API with docker-compose
@echo "Starting infrastructure..."
docker compose -f docker-compose.demo.yml up -d redis decision-api
@echo "Waiting for services to be healthy..."
@sleep 5
@echo "✓ Infrastructure ready!"
@echo ""
@echo "Services:"
@echo " - Decision API: http://localhost:8080"
@echo " - Redis: localhost:6379"
@echo ""
@echo "Next: Update .env with your ENV_ID and API_KEY, then run 'make run'"

stop-infra: ## Stop all services
docker compose -f docker-compose.demo.yml down

run: setup ## Run the demo application
@echo "Running advanced features demo..."
@echo ""
go run main.go

run-docker: setup ## Run demo in Docker
docker compose -f docker-compose.demo.yml --profile demo up demo-app

test: ## Test connection to Decision API
@echo "Testing Decision API connection..."
@curl -f http://localhost:8080/health || (echo "❌ Decision API not reachable" && exit 1)
@echo "✓ Decision API is healthy"
@echo ""
@echo "Testing Redis connection..."
@docker exec $$(docker ps -qf "name=redis") redis-cli ping || (echo "❌ Redis not reachable" && exit 1)
@echo "✓ Redis is healthy"

logs: ## Show Decision API logs
docker compose -f docker-compose.demo.yml logs -f decision-api

logs-redis: ## Show Redis logs
docker compose -f docker-compose.demo.yml logs -f redis

clean: ## Remove all containers and volumes
docker compose -f docker-compose.demo.yml down -v
rm -f .env

inspect-cache: ## Inspect Redis cache contents
@echo "Redis cache keys:"
@docker exec $$(docker ps -qf "name=redis") redis-cli keys "*"
@echo ""
@echo "To view a specific key:"
@echo " docker exec -it $$(docker ps -qf 'name=redis') redis-cli get '<key>'"

clear-cache: ## Clear all Redis cache
@echo "Clearing Redis cache..."
@docker exec $$(docker ps -qf "name=redis") redis-cli flushall
@echo "✓ Cache cleared"

build: ## Build the demo binary
go build -o demo main.go
@echo "✓ Built ./demo"

.DEFAULT_GOAL := help
Loading
Loading