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

Add ability to add ENV variable across all API routes #6842

Open
boyney123 opened this issue Jul 3, 2024 · 2 comments
Open

Add ability to add ENV variable across all API routes #6842

boyney123 opened this issue Jul 3, 2024 · 2 comments
Labels
🛠️ compiler Compiler ✨ enhancement New feature or request needs-discussion Further discussion is needed prior to impl

Comments

@boyney123
Copy link
Contributor

boyney123 commented Jul 3, 2024

Use Case

When defining a Cloud.API we can configure a few props (cors and corsOptions).

When we define routes on the API resource we can also add env to them (see example of GET)

This is a proposal to allow the cloud.Api resource to define these at a high level (when we define the resource itself) through it's (ApiProps). Setting env values here would apply to all routes configured in the API.

Proposed Solution

Allow user to define env variables when creating a new API.

this.api = new cloud.Api({
      env: {
        HELLO: "WORLD"
      }
    }) as "API";

Implementation Notes

No response

Component

No response

Community Notes

  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.
  • If this issue is labeled needs-discussion, it means the spec has not been finalized yet. Please reach out on the #dev channel in the Wing Discord.
@boyney123 boyney123 added ✨ enhancement New feature or request needs-discussion Further discussion is needed prior to impl 🛠️ compiler Compiler labels Jul 3, 2024
@eladb
Copy link
Contributor

eladb commented Jul 3, 2024

@boyney123 What's the use case for passing these environment variables to all api routes?

@boyney123
Copy link
Contributor Author

Hmm yeah good question 😅

Mainly usecases if the API (service) is integrating with 3rd party systems (cloud cache, cloud DB etc), and maybe to share these ENV across all routes in the API? S3 urls etc that they all need access too? Or API URLS they all need access too?

I know previously I have done things with SAM using Globals

Now I think about it more I'm unsure if its really required tbh... maybe we should keep this issue see if any users come back in the future and express interest (or not!).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🛠️ compiler Compiler ✨ enhancement New feature or request needs-discussion Further discussion is needed prior to impl
Projects
Status: 🤝 Backlog - handoff to owners
Development

No branches or pull requests

2 participants