Skip to content

Support for env var parameters #1796

Open
@jwilner

Description

Is your feature request related to a problem? Please describe.

Currently, the project doesn't support environment variables for parameterizing the CLI's behavior. This can result in frustrating conditional construction of CLI invocations littered through more complex toolchains. For instance, our linting code has to call:

if [[ -n "${GITHUB_ACTIONS-}" ]]; then
    npx @redocly/cli lint --format=github-actions 
else
   npx @redocly/cli lint
fi

Describe the solution you'd like

A standard pattern would be to support prefixed environment variables directly mapping to your CLI args. The CLI arg library this project uses supports this very feature. Thus, a minimal change to your application -- e.g. .env("REDOCLY_CLI") -- would permit easier cross-cutting parameterization for clients like REDOCLY_CLI_OUTPUT_FORMAT=github-actions.

I'm happy to open up this PR if it seems like something the project would welcome.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions