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: Add env vars for install and bin args #566

Merged
merged 19 commits into from
Mar 19, 2025

Conversation

yermulnik
Copy link
Collaborator

@yermulnik yermulnik commented Mar 14, 2025

Resolves #561 (discussion)
Resolves #562 (issue from discussion)

  • Add Env vars for custom binary path and custom install path
    • Add Env var for log level for parity with other TOML keys
  • Add TOML config key for custom install path for consistency
  • Improve wording in resolved parameter values debugging output
  • Add tests for new Env vars and TOML config key
  • Re-factor env vars and TOML keys parsing for simplicity and consistency
  • Documentation
  • GitHub Actions:
    • Have workflows read Go version from go.mod instead of explicit hard-coded version
    • Reset generic workflow perms to none and adjust at job level as necessary

Resolves #562

* Add Env vars for custom binary path and custom install path
* Add TOML config key for custom install path for consistency
* Improve wording in resolved parameter values debugging output
* Add tests for new Env vars and TOML config key
* Documentation
  * Update https://tfswitch.warrensbox.com/usage/commandline/ accordingly
  * Update https://tfswitch.warrensbox.com/usage/config-files/ accordingly
  * Add `arch` and `log-level` TOML keys description to https://tfswitch.warrensbox.com/usage/config-files/
  * Improve wording in some places
@github-actions github-actions bot added the new feature New feature or request label Mar 14, 2025
@yermulnik yermulnik requested a review from Copilot March 17, 2025 00:32
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for new environment variables and TOML configuration keys (including custom install path and binary path) and updates related documentation, tests, and workflows for consistency. It also refactors environment variable and configuration parsing for simplicity while updating GitHub Actions workflows to derive the Go version from go.mod.

  • Updates documentation for configuration files and command line usage with new environment variable examples.
  • Adds tests for the new env vars and TOML key, and refactors parameter parsing logic.
  • Updates GitHub Actions workflows to use go-version-file for Go version configuration.

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
www/docs/usage/config-files.md Updated wording and added details for using custom paths and log-levels.
test-data/integration-tests/test_tfswitchtoml/.tfswitch.toml Added install key for specifying a custom install path.
lib/param_parsing/environment.go Refactored environment variable parsing to iterate over paramMappings.
www/docs/usage/commandline.md Updated shell command examples and added new sections for TF_LOG_LEVEL, TF_INSTALL_PATH, and TF_BINARY_PATH.
.github/workflows/* Adjusted workflows to read Go version from go.mod and set minimal permissions.
lib/param_parsing/parameters.go, toml.go, toml_test.go Integrated new parameter mappings and fixed testing for TOML processing.
lib/install.go Minor update to log message for clarity on CPU architecture mismatches.

Copy link
Collaborator

@MatthewJohn MatthewJohn left a comment

Choose a reason for hiding this comment

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

Will finish reviewing after work today

@yermulnik yermulnik requested a review from MatthewJohn March 18, 2025 14:53
…e.md` as of the most recent commits that addressed PR comments
@yermulnik yermulnik requested a review from MatthewJohn March 18, 2025 18:21
@yermulnik yermulnik merged commit 7167017 into master Mar 19, 2025
7 checks passed
@yermulnik yermulnik deleted the feat/Add_env_vars_for_install_and_bin_location branch March 19, 2025 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature request] Environment variable for non-standard install location
2 participants