Port is not overridable with the PORT environment variable #99
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
From the audit against the canonical
REPO_POLICIES.md, verified againstmainat61f42e6.The policy states:
> Dockerized web services listen on port 8080 by default, overridable with
PORT.The default half is correct:
DefaultPort = 8080(internal/config/config.go:23) andEXPOSE 8080(Dockerfile:76). The override half does not exist.config.go:104readsPort: loader.intVal("port", DefaultPort)— YAML file only. A grep forGetenvacrossinternal/andcmd/returns exactly three hits, all inconfig.go:PIXA_CONFIG_PATH(line 340) andHOMEtwice (lines 355-356). There is noPORThandling anywhere.This bites in exactly the deployment the policy is written for.
Dockerfile:78'sENTRYPOINThardcodes--config /etc/pixa/config.yml, so changing the listen port in a container today means bind-mounting a whole replacement config file — for one integer. Container platforms conventionally injectPORT, and this is a prerequisite for a clean uPaaS deployment (#17).Definition of done
PORToverrides the config-file value and the default. Precedence documented explicitly (suggest:PORTenv > config file > default, so the platform can always win).PORTmust abort startup naming the variable and the offending value. Repo policy is explicit that a set-but-invalid explicit value never silently falls back to a default —PORT=bananamust not quietly become 8080. Use the same strict-parsing pattern as the config getters.PORTis a deliberate special case (the policy names onlyPORT). Note theenv:section that smartconfig already provides is a related but different mechanism — see #75, which documents it. Say in the PR how the two interact, so operators are not left guessing which wins.PORT=9090takes effect over a config file specifying 8080;PORT=bananaexits non-zero naming the variable; absentPORTleaves existing behavior unchanged.README.mdandconfig.example.ymldocument the override.make checkgreen.Coordination
Touches
internal/config/config.go, which PR #54 conflicts with heavily (it rewrote that file for lint conformance after absorbing #53). Do after #54 merges.