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

Open
kpervin opened this issue May 9, 2024 · 2 comments
Open

Support better means to set environment variables #1557

kpervin opened this issue May 9, 2024 · 2 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}

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

2 participants