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

Create PowerShell helper function to read config values #2854

Closed
TheCakeIsNaOH opened this issue Oct 11, 2022 · 1 comment · Fixed by #2952
Closed

Create PowerShell helper function to read config values #2854

TheCakeIsNaOH opened this issue Oct 11, 2022 · 1 comment · Fixed by #2952

Comments

@TheCakeIsNaOH
Copy link
Member

Is Your Feature Request Related To A Problem? Please describe.

When running some types of hook packages, it may be ideal or required to retrieve config values from some location. After discussion with @gep13, the config section of the chocolatey.config it would most likely be a good location for users to set config values for hooks to use. However, there is no easy way for hooks to retrieve these values.

Describe The Solution. Why is it needed?

So it would be good to add a helper function to retrieve these values, so they can be used in a hook script.

Additional Context.

N/A

Related Issues

TheCakeIsNaOH added a commit to TheCakeIsNaOH/choco that referenced this issue Dec 28, 2022
This adds a PowerShell helper to get config values from the Chocolatey
configuration file. This helper is intended to be used to allow hook scripts
to access configuration values set in the config.
TheCakeIsNaOH added a commit to TheCakeIsNaOH/choco that referenced this issue Jan 6, 2023
This adds a PowerShell helper to get config values from the Chocolatey
configuration file. This helper is intended to be used to allow hook scripts
to access configuration values set in the config.
TheCakeIsNaOH added a commit to TheCakeIsNaOH/choco that referenced this issue Jan 13, 2023
This adds a PowerShell helper to get config values from the Chocolatey
configuration file. This helper is intended to be used to allow hook scripts
to access configuration values set in the config.
@gep13 gep13 added this to the 2.0.0 milestone Jan 19, 2023
@gep13 gep13 modified the milestones: 2.0.0, 2.1.0 Feb 16, 2023
@gep13 gep13 modified the milestones: 2.1.0, vNext Jun 5, 2023
TheCakeIsNaOH added a commit to TheCakeIsNaOH/choco that referenced this issue Jun 16, 2023
This adds a PowerShell helper to get config values from the Chocolatey
configuration file. This helper is intended to be used to allow hook scripts
to access configuration values set in the config.
TheCakeIsNaOH added a commit to TheCakeIsNaOH/choco that referenced this issue Jun 17, 2023
This adds a PowerShell helper to get config values from the Chocolatey
configuration file. This helper is intended to be used to allow hook scripts
to access configuration values set in the config.
TheCakeIsNaOH added a commit to TheCakeIsNaOH/choco that referenced this issue Jun 17, 2023
This adds a PowerShell helper to get config values from the Chocolatey
configuration file. This helper is intended to be used to allow hook scripts
to access configuration values set in the config.
TheCakeIsNaOH added a commit to TheCakeIsNaOH/choco that referenced this issue Jun 17, 2023
This adds a PowerShell helper to get config values from the Chocolatey
configuration file. This helper is intended to be used to allow hook scripts
to access configuration values set in the config.
@gep13 gep13 modified the milestones: vNext, 2.1.0 Jun 19, 2023
TheCakeIsNaOH added a commit to TheCakeIsNaOH/choco that referenced this issue Jun 20, 2023
This adds a PowerShell helper to get config values from the Chocolatey
configuration file. This helper is intended to be used to allow hook scripts
to access configuration values set in the config.
corbob pushed a commit to corbob/choco that referenced this issue Jun 20, 2023
This adds a PowerShell helper to get config values from the Chocolatey
configuration file. This helper is intended to be used to allow hook scripts
to access configuration values set in the config.
corbob added a commit to corbob/choco that referenced this issue Jun 20, 2023
Add pester tests around the functionality added by
Get-ChocolateyConfigValue
corbob added a commit to corbob/choco that referenced this issue Jun 20, 2023
The catch of Get-ChocolateyConfigValue should reasonably be an error and
not a warning. Changing this to send an error so the package can handle
it if desired.
gep13 added a commit that referenced this issue Jun 20, 2023
@gep13 gep13 added 4 - Done and removed 3 - Review labels Jun 20, 2023
gep13 added a commit that referenced this issue Jun 21, 2023
It is known that when signing a PowerShell file, if there isn't a BOM
in the file, the signature doesn't work properly.

This commit re-encodes the file from UTF-8 to UTF-8 with BOM.

The need for this was caught during end-to-end testing.
gep13 added a commit that referenced this issue Jun 29, 2023
* release/2.1.0: (52 commits)
  (maint) If statement formatting change
  (#3224) Add Assembly Loaded configuration option
  (maint) Resave without BOM
  (#3224) Update version check tests
  (#3174) Store non-normalized package version
  (maint) Add required whitespace
  (#3225) Add Pester Tests to ensure environment
  (#3201 #3225) Re-instate setting of config values
  (maint) Remove env variable for release version
  (maint) Fix encoding of file
  (#3194) Add tab completion for cache command
  (#2854) Re-save file with UTF-8 with BOM
  (#3218) Update Tab Expansion to use Test-Path
  (#3218) Remove try catch block for tab completion
  (build) Use latest Chocolatey.Cake.Recipe package
  (#2854) Do Write-Error instead of Write-Warning
  (#2854) Pester tests to Get-ChocolateyConfigValue
  (maint) Resave Get-ChocolateyConfigValue as CRLF
  (#2854) Add helper to read config values
  (#3214) Add Pester tests to ensure cache cleared
  ...
@choco-bot
Copy link

🎉 This issue has been resolved in version 2.1.0 🎉

The release is available on:

Your GitReleaseManager bot 📦🚀

gep13 added a commit that referenced this issue Jun 29, 2023
* master:
  (maint) If statement formatting change
  (#3224) Add Assembly Loaded configuration option
  (maint) Resave without BOM
  (#3224) Update version check tests
  (#3174) Store non-normalized package version
  (maint) Add required whitespace
  (#3225) Add Pester Tests to ensure environment
  (#3201 #3225) Re-instate setting of config values
  (maint) Remove env variable for release version
  (maint) Fix encoding of file
  (#3194) Add tab completion for cache command
  (#2854) Re-save file with UTF-8 with BOM
  (#3218) Update Tab Expansion to use Test-Path
  (#3218) Remove try catch block for tab completion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants