Skip to content

fix(default-env): read comments#248

Merged
adilsitos merged 1 commit into
mainfrom
fix-default-env-value
May 29, 2026
Merged

fix(default-env): read comments#248
adilsitos merged 1 commit into
mainfrom
fix-default-env-value

Conversation

@adilsitos
Copy link
Copy Markdown
Contributor

Description 📣

The previous implementation was not checking the env comments, which did not allowed the definition of default values.

Type ✨

  • Bug fix
  • New feature
  • Improvement
  • Breaking change
  • Documentation

Tests 🛠️

  • Connect into infisical using the CLI

  • Add a comment with DEFAULT:FOO

  • check that when you run go run . secrets generate-example-env you have an output with a default value.

  • I have read the contributing guide, agreed and acknowledged the code of conduct. 📝

@adilsitos adilsitos requested a review from varonix0 May 29, 2026 13:01
@infisical-review-police
Copy link
Copy Markdown

💬 Discussion in Slack: #pr-review-cli-248-fix-default-env-read-comments

Posted by Review Police — reviews, comments, new commits, and CI failures will stream into this channel.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 29, 2026

Greptile Summary

This PR fixes the secrets generate-example-env command by propagating the SecretComment field from the API response into the Comment field of SingleEnvironmentVariable at all relevant construction sites. Without this fix, comments containing DEFAULT: directives were silently dropped, so the generated example env file always had empty values.

  • Adds Comment: secret.SecretComment in GetPlainTextSecretsViaServiceToken, GetPlainTextSecretsV3, and InjectRawImportedSecret — the three code paths that were missing it.
  • GetSinglePlainTextSecretByNameV3 already mapped the comment field and required no change.

Confidence Score: 5/5

The change is safe to merge — it adds a previously missing field assignment in three symmetric construction sites with no side effects.

The diff is a minimal, targeted fix: three construction sites of SingleEnvironmentVariable now include Comment: secret.SecretComment, exactly mirroring the pattern already in GetSinglePlainTextSecretByNameV3. No logic is removed or reordered, and the field was already present in the model; it simply wasn't being populated. The fix is consistent across all three affected code paths and has no observable impact outside the generate-example-env command.

No files require special attention.

Important Files Changed

Filename Overview
packages/util/secrets.go Adds Comment: secret.SecretComment to three SingleEnvironmentVariable construction sites (service-token path, V3 access-token path, and imported-secrets injection) so the generate-example-env command can read DEFAULT values from secret comments

Reviews (1): Last reviewed commit: "fix: read comments value" | Re-trigger Greptile

@adilsitos adilsitos merged commit 4fcb93a into main May 29, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants