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

Support better means to set environment variables #1557

Closed
kpervin opened this issue May 9, 2024 · 4 comments
Closed

Support better means to set environment variables #1557

kpervin opened this issue May 9, 2024 · 4 comments

Comments

@kpervin
Copy link

kpervin commented May 9, 2024

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

Currently there is only a single way to load environment variables into the config, and that is via the envVariable field in the resolve.http.headers array. However, you cannot load these into apis.{config}.root or into the resolve.http.headers[num].matches field.

Describe the solution you'd like

A means of loading env variables akin to GraphQL Config. They use a library called string-env-interpolation (ref to line in their source).

@tatomyr
Copy link
Contributor

tatomyr commented May 24, 2024

Hi @kpervin! Sorry for the delay. Could you clarify your suggestion? Do you want to be able to provide env variables for apis? Or to change the env syntax? Maybe you could provide an example of such config?

@kpervin
Copy link
Author

kpervin commented May 24, 2024

It would be nice to be able to provide env variables for pretty much the whole config, apart from the reserved key fields. For example:

apis:
  v4:
    root: https://${DOMAIN}/v3/api-docs/User%20API%20v4
    x-openapi-ts:
      output: ./src/v4.d.ts
  v3:
    root: https://${DOMAIN}/v3/api-docs/UserV3
    x-openapi-ts:
      output: ./src/v3.d.ts
resolve:
  http:
    headers:
      - matches: https://${DOMAIN}/**
        name: Authorization
        envVariable: ${API_KEY}

@tatomyr
Copy link
Contributor

tatomyr commented May 27, 2024

Oh, I see. Thanks for the clarification!

@lornajane
Copy link
Collaborator

Thanks for the suggestion, but the config files are intentionally static. I would recommend you add some pre-processing scripts of your own to pick up environment variables if that's an important part of your workflow. We're not planning to implement support for environment variables at this time - which I know isn't what you were hoping for, but it's important to us to be clear about what you can expect.

@lornajane lornajane closed this as not planned Won't fix, can't repro, duplicate, stale Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants