Skip to content

Commit f7b0138

Browse files
TMHSDigitalclaude
andcommitted
fix(make): let environment variables set run parameters (#225)
make help told users to customize runs with environment variables (HIT_RATE=30 make simulate-verbose), but WORDLIST, CONCURRENCY, TIMEOUT, DNS_SERVER, HIT_RATE, WL_COMBINE and WL_OUTPUT were assigned with plain =, which overrides the environment, so the run silently used defaults. Assign them with ?= so both forms work, and list the bench, docs-flags and all targets in help. Fixes #225 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 1fcd5bc commit f7b0138

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

‎Makefile‎

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,21 @@ LDFLAGS = -ldflags "-X main.Version=$(VERSION)"
1515
# Default run parameters. Live targets (run, run-verbose, run-custom,
1616
# docker-run) have no default DOMAIN: they send real DNS queries, so you must
1717
# name a domain you own or are authorized to test, e.g. make run DOMAIN=...
18-
WORDLIST=examples/sample_wordlist.txt
19-
CONCURRENCY=100
20-
TIMEOUT=1000
21-
DNS_SERVER=8.8.8.8:53
18+
# Parameters use ?= so both `make VAR=x target` and `VAR=x make target` work.
19+
WORDLIST ?= examples/sample_wordlist.txt
20+
CONCURRENCY ?= 100
21+
TIMEOUT ?= 1000
22+
DNS_SERVER ?= 8.8.8.8:53
2223

2324
# Simulation parameters. Simulated targets send no DNS traffic, so they fall
2425
# back to example.com when DOMAIN is not set.
25-
HIT_RATE=15
26+
HIT_RATE ?= 15
2627
SIM_DOMAIN=$(or $(DOMAIN),example.com)
2728

2829
# Wordlist generator parameters
2930
WL_DOMAIN ?= $(SIM_DOMAIN)
30-
WL_COMBINE=dev,staging,test,api
31-
WL_OUTPUT=custom-wordlist.txt
31+
WL_COMBINE ?= dev,staging,test,api
32+
WL_OUTPUT ?= custom-wordlist.txt
3233

3334
all: build
3435

@@ -124,9 +125,11 @@ docker-simulate:
124125
# Help command
125126
help:
126127
@echo "Available commands:"
127-
@echo " make build - Build the binary"
128-
@echo " make test - Run all tests"
128+
@echo " make build - Build the binary (also: make all)"
129+
@echo " make test - Run all tests (CI also uses -race -shuffle=on)"
129130
@echo " make test-short - Run short tests"
131+
@echo " make bench - Dispatcher benchmark on a 1M-entry simulated scan"
132+
@echo " make docs-flags - Regenerate docs/_includes/flags.md from the CLI flags"
130133
@echo " make clean - Clean build artifacts"
131134
@echo " make lint - Run linter"
132135
@echo " make tidy - go mod tidy (keeps go 1.26.0)"
@@ -166,7 +169,8 @@ help:
166169
@echo " WL_COMBINE=$(WL_COMBINE)"
167170
@echo " WL_OUTPUT=$(WL_OUTPUT)"
168171
@echo ""
169-
@echo "Customize parameters by setting environment variables, e.g.:"
172+
@echo "Customize parameters on the command line or as environment variables, e.g.:"
173+
@echo " make run DOMAIN=yourdomain.com WORDLIST=path/to/wordlist.txt"
170174
@echo " DOMAIN=yourdomain.com WORDLIST=path/to/wordlist.txt make run"
171175
@echo " WL_DOMAIN=yourdomain.com WL_COMBINE=dev,api,v1 make wordlist"
172176
@echo " HIT_RATE=30 make simulate-verbose"

0 commit comments

Comments
 (0)