Skip to content

feat(cli): add environment variable support for CLI commands#2158

Merged
DmitryAnansky merged 1 commit intomainfrom
feat/support-env-var-parameters
Jul 4, 2025
Merged

feat(cli): add environment variable support for CLI commands#2158
DmitryAnansky merged 1 commit intomainfrom
feat/support-env-var-parameters

Conversation

@DmitryAnansky
Copy link
Contributor

@DmitryAnansky DmitryAnansky commented Jul 1, 2025

What/Why/How?

Added environment variable support for CLI arguments using Yargs env() method to parse environment variables with matching prefixes.
Suggested prefix format is REDOCLY_CLI_{COMMAND_NAME}.

Alternative

We can have single REDOCLY_CLI prefix, but this can be confusing when args name is the same for different commands in a single environment, but you need to use different values.

Reference

Closes: #1796

Testing

Screenshots (optional)

Check yourself

  • Code changed? - Tested with redoc (internal)
  • All new/updated code is covered with tests
  • New package installed? - Tested in different environments (browser/node)

Security

  • Security impact of change has been considered
  • Code follows company security practices and guidelines

@changeset-bot
Copy link

changeset-bot bot commented Jul 1, 2025

🦋 Changeset detected

Latest commit: 46ad3d9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@redocly/cli Minor
@redocly/openapi-core Minor
@redocly/respect-core Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Jul 1, 2025

Command Mean [ms] Min [ms] Max [ms] Relative
redocly lint packages/core/src/benchmark/benches/rebilly.yaml 953.0 ± 12.7 928.8 970.3 1.00
redocly-next lint packages/core/src/benchmark/benches/rebilly.yaml 1036.9 ± 29.0 997.2 1088.9 1.09 ± 0.03

@DmitryAnansky DmitryAnansky marked this pull request as ready for review July 1, 2025 14:50
@DmitryAnansky DmitryAnansky requested review from a team as code owners July 1, 2025 14:50
@DmitryAnansky DmitryAnansky requested a review from RomanHotsiy July 1, 2025 14:56
@DmitryAnansky DmitryAnansky force-pushed the feat/support-env-var-parameters branch from 6421322 to 46ad3d9 Compare July 4, 2025 13:55
@DmitryAnansky DmitryAnansky merged commit 58a4cc9 into main Jul 4, 2025
36 checks passed
@DmitryAnansky DmitryAnansky deleted the feat/support-env-var-parameters branch July 4, 2025 14:03
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.

Support for env var parameters

4 participants