- Created bible/ with hierarchical documentation (architecture, pricelists, vendor mapping, background tasks, data rules, patterns, API, operations, history) - CLAUDE.md reduced to one instruction: read and follow the bible - README.md reduced to quick start only - Removed MEMORY.md and csv_export.md (content consolidated into bible/) - Fixed stale facts found during audit: weighted_avg (not weighted_median), correct API route names (/export-csv, /recalculate-all) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2.5 KiB
2.5 KiB
Operations
Configuration (config.yaml)
server:
host: "127.0.0.1" # loopback-only
port: 8084
mode: "release" # debug | release
read_timeout: "30s"
write_timeout: "30s"
database:
host: "localhost"
port: 3306
name: "RFQ_LOG"
user: "priceforge"
password: "CHANGE_ME"
max_open_conns: 25
max_idle_conns: 5
conn_max_lifetime: "5m"
pricing:
default_method: "weighted_median"
default_period_days: 90
freshness_green_days: 30
freshness_yellow_days: 60
freshness_red_days: 90
min_quotes_for_median: 3
export:
temp_dir: "/tmp/priceforge-exports"
max_file_age: "1h"
alerts:
enabled: true
check_interval: "1h"
high_demand_threshold: 5
logging:
level: "info" # debug | info | warn | error
format: "json" # json | text
Quick Start
cp config.example.yaml config.yaml
# Edit config.yaml: database.host, database.name, database.user, database.password
make run
# Open: http://127.0.0.1:8084/admin/pricing
Commands
# Run
make run
go run ./cmd/pfs
# Build
make build # dev build
make build-release # optimized, version via ldflags
make build-all # cross-compile Linux/macOS/Windows
# Migrations
go run ./cmd/pfs -migrate
# Version
./bin/pfs -version
# Tests
make test
# Clean
make clean
Build System (Makefile)
| Target | Action |
|---|---|
run |
go run ./cmd/pfs |
build |
Dev build with debug info |
build-release |
-s -w stripped + version ldflags |
build-linux |
GOOS=linux GOARCH=amd64 |
build-macos |
GOOS=darwin GOARCH=arm64 |
build-windows |
GOOS=windows |
build-all |
All platforms |
release |
./scripts/release.sh |
test |
go test -v ./... |
clean |
Remove bin/ |
deps |
go mod download && go mod tidy |
watch |
Auto-restart with entr |
Build variables:
CGO_ENABLED=0— static binariesVERSION— fromgit describeor"dev"LDFLAGS—-s -w -X main.Version=$(VERSION)
Release
./scripts/release.sh
# Creates: releases/<version>/ with archives and SHA256SUMS.txt
Migrations
SQL migrations in migrations/ (25 files). Applied automatically on startup.
Manual run: go run ./cmd/pfs -migrate
Migration runner: internal/models/sql_migrations.go
macOS Gatekeeper
After downloading the binary:
xattr -d com.apple.quarantine /path/to/pfs-darwin-arm64
Requirements
- Go 1.22+
- MariaDB / MySQL (working database, e.g.
RFQ_LOG)