Skip to content

(#3675) Extract all used environment variables #3241

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

AdmiringWorm
Copy link
Member

@AdmiringWorm AdmiringWorm commented Jun 30, 2023

Description Of Changes

These changes extracts all of the environment variables that we
make use of while running Chocolatey CLI. Both variables that are
used as part of running package scripts, and variables we use
only when they are set on the system.

A change to make these environment variables and all other internal
types available to other products and the test projects has been made.

Motivation and Context

To be able to have a single location to add and use environment variable names from.

Testing

N/A. Need to be ran through test kitchen.

Operating Systems Testing

  • Windows 10

Change Types Made

  • Bug fix (non-breaking change).
  • Feature / Enhancement (non-breaking change).
  • Breaking change (fix or feature that could cause existing functionality to change).
  • Documentation changes.
  • PowerShell code changes.

Change Checklist

  • Requires a change to the documentation.
  • Documentation has been updated.
  • Tests to cover my changes, have been added.
  • All new and existing tests passed?
  • PowerShell code changes: PowerShell v2 compatibility checked?

Related Issue

fixes #3675

@AdmiringWorm AdmiringWorm self-assigned this Jun 30, 2023
@AdmiringWorm AdmiringWorm requested a review from gep13 June 30, 2023 11:12
@AdmiringWorm AdmiringWorm force-pushed the environment-variables branch 2 times, most recently from df1f840 to 76676a3 Compare June 30, 2023 12:04
@AdmiringWorm AdmiringWorm marked this pull request as draft June 30, 2023 12:49
@AdmiringWorm
Copy link
Member Author

Putting this back to draft, as we can not make all internal types available for dependent projects.

@AdmiringWorm AdmiringWorm force-pushed the environment-variables branch from 76676a3 to bf0d8b9 Compare June 30, 2023 13:55
@AdmiringWorm AdmiringWorm marked this pull request as ready for review June 30, 2023 13:56
@gep13 gep13 added this to the 2.5.0 milestone May 29, 2025
@AdmiringWorm AdmiringWorm changed the title (maint) Extract all used environment variables (#3675) Extract all used environment variables Jun 2, 2025
@AdmiringWorm AdmiringWorm force-pushed the environment-variables branch 2 times, most recently from e489690 to 7cfa192 Compare June 2, 2025 13:16
@AdmiringWorm AdmiringWorm marked this pull request as draft June 2, 2025 13:16
@AdmiringWorm
Copy link
Member Author

Converted this PR to draft until it is ready to be reviewed.

@AdmiringWorm AdmiringWorm force-pushed the environment-variables branch 2 times, most recently from 4ba0e57 to c507e12 Compare June 2, 2025 13:39
These changes extracts all of the environment variables that we
make use of while running Chocolatey CLI. Both variables that are
used as part of running package scripts, and variables we use
only when they are set on the system.

A change to make these environment variables and all other internal
types available to other products and the test projects has been made.
…sources

Update EnvironmentVariables class to reference constants from
chocolatey.StringResources instead of hardcoded strings. Mark the
old EnvironmentVariables class as obsolete to enforce usage of the
new centralized resource definitions.

Refactor Helpers/Paths.cs and Helpers/EnvironmentHelper.cs to use
EnvironmentVariables.System.Path for PATH variable access and
modification, ensuring consistency with the updated resource usage.

These changes improve maintainability by consolidating environment
variable names in a single source and prevent duplication errors.
@AdmiringWorm AdmiringWorm force-pushed the environment-variables branch from c507e12 to c439222 Compare June 3, 2025 08:43
@AdmiringWorm AdmiringWorm marked this pull request as ready for review June 3, 2025 11:20
@AdmiringWorm
Copy link
Member Author

@gep13 this PR is now ready for review.

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.

Refactor Environment Variable Usage into Centralized Constants Class
2 participants