fix(agent): strip inline comments in env file parsing (#883) - #884
Merged
Merged
Conversation
loadEnvFile only skipped full-comment lines, so a line like NETPULSE_SCAN_INTERVAL=0 # comment yielded the literal value "0 # comment", missed the exact "0" match and fell back to the 30m default. Truncate values at the first " #" before trimming quotes; server-generated values (URL, token, SPKI FP) never contain " #".
This was referenced Sep 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Qué
loadEnvFilesolo ignoraba líneas de comentario completas; un comentario inline tras el valor (KEY=0 # nota) formaba parte del valor. En concretoNETPULSE_SCAN_INTERVAL=0 # ...no coincidía con el "0" exacto y caía en el warning "inválido, usando 30m" en vez de desactivar los scans.Fix
Recortar el valor en el primer
#antes de quitar comillas/espacios. Los valores que genera el server (URL, token, FP SPKI) nunca contienen#, así que es seguro.Reportado por @crowedavid en #851 (comentario).
Tests
TestLoadConfigInlineComments:SCAN_INTERVAL=0con comentario inline aplicaScanDisabled; comentarios tras duración y tras valor entrecomillado se recortan.go vet ./... && go test ./...del agente: todo ok.agent/VERSION3.0.2 -> 3.0.3 (puerta CI).Closes #883