Skip to content

feat: expose PROJECT_ID via environment variable#229

Open
MattCrossingham wants to merge 2 commits into
Infisical:mainfrom
MattCrossingham:feat/expose-project-id-env
Open

feat: expose PROJECT_ID via environment variable#229
MattCrossingham wants to merge 2 commits into
Infisical:mainfrom
MattCrossingham:feat/expose-project-id-env

Conversation

@MattCrossingham
Copy link
Copy Markdown

Fixes #213

This PR allows users to pass the project ID via the INFISICAL_PROJECT_ID or PROJECT_ID environment variables across all CLI commands.

Previously, users using CI/CD pipelines had to explicitly pass --projectId=... as a flag, even if they had PROJECT_ID exported in their environment (unlike INFISICAL_TOKEN which was automatically picked up). This update uses GetCmdFlagOrEnvWithDefaultValue to cleanly fall back to the environment variables if the flag is omitted.

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eb5cafb4c4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

INFISICAL_DEFAULT_EU_URL = "https://eu.infisical.com"
INFISICAL_WORKSPACE_CONFIG_FILE_NAME = ".infisical.json"
INFISICAL_TOKEN_NAME = "INFISICAL_TOKEN"
INFISICAL_PROJECT_ID_NAME = "INFISICAL_PROJECT_ID"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid letting generic PROJECT_ID override config

Because this introduces the bare PROJECT_ID name, all call sites added in this commit now treat any existing cloud/CI PROJECT_ID as the Infisical project before the previous .infisical.json fallback runs; for example GetAllEnvironmentVariables only reads the workspace file when WorkspaceId is empty. In environments that already export PROJECT_ID for another system, commands such as run, secrets set/delete, or export will silently bypass the repo’s configured Infisical project and can fail or operate on the wrong project. Prefer only the Infisical-specific env var here, or consult the generic name after the workspace-file fallback.

Useful? React with 👍 / 👎.

@MattCrossingham
Copy link
Copy Markdown
Author

Thanks @chatgpt-codex-connector! You are absolutely right. I've removed the generic PROJECT_ID fallback to prevent those collisions. It now strictly looks for INFISICAL_PROJECT_ID to match the INFISICAL_TOKEN pattern.

@chatgpt-codex-connector
Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

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.

PROJECT_ID should be exposed as an env value just like INFISICAL_TOKEN

1 participant