Omit empty fields from bootstrap config output

probod-bootstrap was writing empty strings and stub blocks such as
`esign: {}` into generated YAML. The post-marshal prune pass caused
part of that by stripping empty leaf strings while leaving empty
parent maps behind.

Drop the prune round-trip in WriteConfig and rely on struct-level
omitzero/omitempty tags plus custom IsZero() helpers on probodconfig.
Only include LLM providers when an API key is set, use a nil map for
extra API headers, and extend the dev-config Makefile recipe with the
local dev defaults already documented in .env.example.

Config loading is unchanged: omitted keys still decode to Go zero
values.

Signed-off-by: Ludovic Vielle <ludovic@probo.com>
This commit is contained in:
Ludovic Vielle
2026-07-01 10:15:28 +02:00
parent 2be3e18437
commit e22aaa8b67
17 changed files with 380 additions and 195 deletions

View File

@@ -201,18 +201,37 @@ $(CFG_DEV_OAUTH2_KEY):
cfg/dev.yaml: bin/probod-bootstrap $(CFG_DEV_OAUTH2_KEY) compose/pebble/certs/rootCA.pem $(wildcard $(DEV_ENV))
@$(MKDIR) $(@D)
set -a; \
PROBOD_BASE_URL=http://localhost:8080; \
PROBOD_API_ADDR=:8080; \
PROBOD_ENCRYPTION_KEY="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; \
PROBOD_AUTH_COOKIE_NAME=SSID; \
PROBOD_AUTH_COOKIE_DOMAIN=localhost; \
PROBOD_AUTH_COOKIE_SECRET="this-is-a-secure-secret-for-cookie-signing-at-least-32-bytes"; \
PROBOD_AUTH_PASSWORD_PEPPER="this-is-a-secure-pepper-for-password-hashing-at-least-32-bytes"; \
PROBOD_AUTH_COOKIE_SECURE=false; \
PROBOD_OAUTH2_SERVER_SIGNING_KEY="$$($(CAT) $(CFG_DEV_OAUTH2_KEY))"; \
PROBOD_API_CORS_ALLOWED_ORIGINS="http://localhost:8080,http://localhost:5173,http://localhost:5174"; \
PROBOD_PG_ADDR=localhost:5432; \
PROBOD_PG_USERNAME=postgres; \
PROBOD_PG_PASSWORD=postgres; \
PROBOD_PG_DATABASE=probod; \
PROBOD_TRUST_CENTER_HTTP_ADDR=:10080; \
PROBOD_TRUST_CENTER_HTTPS_ADDR=:10443; \
PROBOD_AWS_REGION=us-east-1; \
PROBOD_AWS_BUCKET=probod; \
PROBOD_AWS_ACCESS_KEY_ID=probod; \
PROBOD_AWS_SECRET_ACCESS_KEY=thisisnotasecret; \
PROBOD_AWS_ENDPOINT=http://127.0.0.1:8333; \
PROBOD_SMTP_ADDR=localhost:1025; \
PROBOD_MAILER_SENDER_EMAIL=no-reply@notification.getprobo.com; \
PROBOD_MAILER_SENDER_NAME=Probo; \
PROBOD_OPENAI_API_KEY=thisisnotasecret; \
PROBOD_AGENT_THIRD_PARTY_VETTER_PROVIDER=openai; \
PROBOD_AGENT_THIRD_PARTY_VETTER_MODEL_NAME=gpt-4o; \
PROBOD_CHROME_DP_ADDR=localhost:9222; \
PROBOD_ACME_DIRECTORY=https://localhost:14000/dir; \
PROBOD_ACME_EMAIL=admin@probo.com; \
PROBOD_ACME_ROOT_CA="$$($(CAT) compose/pebble/certs/rootCA.pem)"; \
if [ -f $(DEV_ENV) ]; then . $(DEV_ENV); fi; \
set +a; \
./bin/probod-bootstrap -output $@