# Operations ## Configuration (`config.yaml`) ```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 ```bash 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 ```bash # 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 binaries - `VERSION` — from `git describe` or `"dev"` - `LDFLAGS` — `-s -w -X main.Version=$(VERSION)` --- ## Release ```bash ./scripts/release.sh # Creates: releases// 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: ```bash xattr -d com.apple.quarantine /path/to/pfs-darwin-arm64 ``` --- ## Requirements - Go 1.22+ - MariaDB / MySQL (working database, e.g. `RFQ_LOG`)