Skip to content

Add environment variable support for select parameters #315

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

Merged
merged 10 commits into from
Apr 15, 2025

Conversation

cidrblock
Copy link
Collaborator

@cidrblock cidrblock commented Apr 11, 2025

Create a mapping between environment variables and an argparse dest. To preserve a CLI->ENV->default order of precedence we'll look for each of the mapping's option strings in the cli paramters. If provided on the CLI, ignore the enviroment variable. If not provided use an enviroment variable if set.

Environment variable are added to their respective attribute help string.

All ADE specific enviroment variables are prefaced with ADE_ to avoid a conflict with other applicaitons.

This moves and renames the SKIP_UV enviroment variables out to the parser as ADE_UV and adds a command line parameter to match (#278) Backward compatible support was added.

This also revises the use of VIRTUAL_ENV such that it is the enviroment variable for the --venv command line paramter and used if --venv if not provided by the user. (#276). The venv will default to .venv unless VIRTUAL_ENV is set.

This cleans up the NO_COLOR enviroment varaible such that it is now the enviroment variable which cooresponds to the --ansi command line parameter.

Added support for ADE_ISOLATION_MODE mapped to --isolation_mode
Added support for ADE_VERBOSE mapped to -v

Tests updated as needed, largley due the correction of precedense and handling of a non existent venv, as virtual enviroments are now only build when the subcommand is install

Additional tests forthcoming for new code.

@cidrblock cidrblock requested a review from a team as a code owner April 11, 2025 21:43
@cidrblock cidrblock added the enhancement New feature or request label Apr 11, 2025
@cidrblock cidrblock marked this pull request as draft April 11, 2025 21:45
@cidrblock cidrblock marked this pull request as ready for review April 14, 2025 19:21
@ssbarnea ssbarnea merged commit 191e254 into ansible:main Apr 15, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants