Files
miti99bot/Makefile
T
tiennm99 28a9676690 feat(storage): Firestore KVStore + KVProvider abstraction
Phase 04 of go-port-cloud-run plan. Introduces KVProvider abstraction
with memory backend (via Prefixed wrapper) and Firestore backend (via
collection-per-module isolation). Backend selection gated by env vars:
GOOGLE_CLOUD_PROJECT or FIRESTORE_EMULATOR_HOST → Firestore, else memory.
Emulator-gated tests via `make test-emulator`. Security hardened: emulator
fallback project ID, prefix validation on List, length-in-bytes docs.
2026-05-08 23:51:24 +07:00

29 lines
893 B
Makefile

.PHONY: test test-emulator firestore-emulator vet build run
# Default: run unit tests that don't require the Firestore emulator.
test:
go test -race -count=1 ./...
# Start a local Firestore emulator (separate terminal). Requires gcloud SDK
# with the cloud-firestore-emulator component installed:
# gcloud components install cloud-firestore-emulator
firestore-emulator:
gcloud emulators firestore start --host-port=localhost:8085
# Run all tests including emulator-gated ones. Expects the emulator to be
# already running (use `make firestore-emulator` in another shell).
test-emulator:
FIRESTORE_EMULATOR_HOST=localhost:8085 \
GOOGLE_CLOUD_PROJECT=miti99bot-go-test \
go test -race -count=1 ./...
vet:
go vet ./...
build:
CGO_ENABLED=0 go build -ldflags="-s -w" -o ./bin/server ./cmd/server
# Local dev run with an in-memory KV (no Firestore needed).
run:
go run ./cmd/server