Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added export option to secrets env #342 #348

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from

Conversation

Sooryasanand
Copy link

@Sooryasanand Sooryasanand commented Dec 18, 2024

Description

I have introduced an export flag in options.ts to determine whether the export keyword should be prefixed to environment variables for shell usage. This is relevant for Unix-based systems, where export is required to make the variables available to child processes. On Windows, however, the export keyword or an equivalent is unnecessary because a child process automatically inherits the environment variables of its parent process. This behavior is documented on the official Microsoft website: Environment Variables.

Issues Fixed

Tasks

  • 1. Add export option for json
  • 2. Add Tests

Final checklist

  • Domain specific tests
  • Full tests
  • Updated inline-comment documentation
  • Lint fixed
  • Squash and rebased
  • Sanity check the final build

Comment on lines +286 to +290
if (options.envExport) {
data += `export ${key}='${value}'\n`;
} else {
data += `${key}='${value}'\n`;
}
Copy link
Author

Choose a reason for hiding this comment

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

The if statement applies to Unix systems. On Windows, an equivalent check is unnecessary because the export keyword (or equivalent) isn’t needed. On Windows, child processes automatically inherit the parent process's environment variables, as documented on the official Microsoft website: Environment Variables.

Copy link
Member

Choose a reason for hiding this comment

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

If that is the case, then instead of making this an option, we can probably make this another env format - something like --env-format unix-export. Or we can also rename this to be --env-format unix-local for non-export and --env-format unix-global for exported environment variables. Thoughts, @CMCDragonkai?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Add export formats to secrets env command
2 participants