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

Add export formats to secrets env command #342

Open
tegefaulkes opened this issue Dec 9, 2024 · 3 comments · May be fixed by #348
Open

Add export formats to secrets env command #342

tegefaulkes opened this issue Dec 9, 2024 · 3 comments · May be fixed by #348
Assignees
Labels
development Standard development

Comments

@tegefaulkes
Copy link
Contributor

Specification

Currently the secrets env command contains different formats that get generated when it's not running a command. We need to add variants to these formats that include export within the file.

For example the unix format is structured as

ENV_ONE="one";
ENV_TWO="two";

But the new variant will include the export keyword

export ENV_ONE="one";
export ENV_TWO="two";

This should apply to all the existing formats where applicable. So if the cmd and powershell if they have a equavalent way of exporting env variables within a script then we should have a format version for them as well.

Additional context

Tasks

  1. Add an export variant format for the unix format
  2. Add an export variant for all other formats that can support it.
@tegefaulkes tegefaulkes added the development Standard development label Dec 9, 2024
Copy link

linear bot commented Dec 9, 2024

@CMCDragonkai
Copy link
Member

Should be an option.

@aryanjassal aryanjassal self-assigned this Dec 17, 2024
@Sooryasanand Sooryasanand linked a pull request Dec 18, 2024 that will close this issue
8 tasks
@Sooryasanand
Copy link

Feature Summary: Export Option for secrets env

This feature introduces an --env-export flag to the secrets env command, allowing it to handle environment variables in a way that ensures compatibility with child processes across multiple platforms.

Key Functionalities

1. Unix Format

Previous Behavior:

Environment variables were output as:

ENV_VAR="value"

This format sets variables but does not export them, meaning they are not available to child processes unless explicitly exported.

New Behavior with --env-export:

export ENV_VAR="value"

Adding the export prefix ensures that the variables are propagated to child processes. This is essential for scripts requiring child processes to inherit these variables.


2. Windows PowerShell

With --env-export:

Variables are set as global or session-specific based on context:

$env:ENV_VAR = 'value'

Without --env-export:

Variables are scoped only to the current PowerShell session:

$ENV_VAR = 'value'

Dynamic Updates:

The variables are immediately updated in the current session and optionally persist globally based on the flag.


3. Windows CMD

Default Behavior:

Variables are set using set commands, which inherently propagate to child processes:

set ENV_VAR=value

New Behavior:

No additional export mechanism is needed since CMD already ensures propagation of variables to child processes.

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

Successfully merging a pull request may close this issue.

4 participants